Fix an infinite loop in ircd.c and skip clone checking for 0.0.0.0 clients.
authorMichael Poole <mdpoole@troilus.org>
Mon, 3 Jan 2005 23:49:32 +0000 (23:49 +0000)
committerMichael Poole <mdpoole@troilus.org>
Mon, 3 Jan 2005 23:49:32 +0000 (23:49 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1292 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/IPcheck.c
ircd/ircd.c

index f96560ba2f0dd61eca18bc7e0484db4bfb6eae4e..5e333092b800113262ee2215bed60ad7891efa40 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-01-03  Michael Poole <mdpoole@troilus.org>
+
+       * ircd/IPcheck.c (ip_registry_check_remote): Do not count clones
+       that have an invalid IP address.
+
+       * ircd/ircd.c (try_connections): Update Connect hold time before
+       skipping it, to prevent infinite loops.
+
 2005-01-03  Kevin L Mitchell  <klmitch@mit.edu>
 
        * ircd/s_user.c (is_silenced): is_silenced() would core if sptr
index 4c1521f2e9d92f20f52e07b58fd6b5e9368f6624..af94d8cc50ba4a8484fdc778ff65ccfb87cfa32c 100644 (file)
@@ -326,12 +326,15 @@ int ip_registry_check_local(const struct irc_in_addr *addr, time_t* next_target_
  */
 int ip_registry_check_remote(struct Client* cptr, int is_burst)
 {
-  struct IPRegistryEntry* entry = ip_registry_find(&cli_ip(cptr));
+  struct IPRegistryEntry* entry;
 
   /*
    * Mark that we did add/update an IPregistry entry
    */
   SetIPChecked(cptr);
+  if (!irc_in_addr_valid(&cli_ip(cptr)))
+    return 1;
+  entry = ip_registry_find(&cli_ip(cptr));
   if (0 == entry) {
     entry = ip_registry_new_entry();
     ip_registry_canonicalize(&entry->addr, &cli_ip(cptr));
index 2ed022bcb3cde8cab777c9a53cb2a4b279289235..754ecab1e4535937bcb1d82d6d0bcae04dfda3d0 100644 (file)
@@ -267,20 +267,20 @@ static void try_connections(struct Event* ev) {
     if (next > aconf->hold || next == 0)
         next = aconf->hold;
 
-    /* Skip this entry if its use is still on hold until future, too
-     * many links in its connection class, it is already linked, or if
-     * connect rules forbid a link now.
-     */
+    /* Update the next time we can consider this entry. */
     cltmp = aconf->conn_class;
+    aconf->hold = ConFreq(cltmp) ? CurrentTime + ConFreq(cltmp) : 0;
+
+    /* Do not try to connect if its use is still on hold until future,
+     * too many links in its connection class, it is already linked,
+     * or if connect rules forbid a link now.
+     */
     if ((aconf->hold > CurrentTime)
         || (Links(cltmp) >= MaxLinks(cltmp))
         || FindServer(aconf->name)
         || conf_eval_crule(aconf->name, CRULE_MASK))
       continue;
 
-    /* We want to connect; update entry's hold time. */
-    aconf->hold = ConFreq(cltmp) ? CurrentTime + ConFreq(cltmp) : 0;
-
     /* Ensure it is at the end of the list for future checks. */
     if (aconf->next) {
       /* Find aconf's location in the list and splice it out. */