From 54e02ed6d1a4b45c942c277a98360479a047d30a Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Mon, 3 Jan 2005 23:49:32 +0000 Subject: [PATCH] Fix an infinite loop in ircd.c and skip clone checking for 0.0.0.0 clients. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1292 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 8 ++++++++ ircd/IPcheck.c | 5 ++++- ircd/ircd.c | 14 +++++++------- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index f96560b..5e33309 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-01-03 Michael Poole + + * 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 * ircd/s_user.c (is_silenced): is_silenced() would core if sptr diff --git a/ircd/IPcheck.c b/ircd/IPcheck.c index 4c1521f..af94d8c 100644 --- a/ircd/IPcheck.c +++ b/ircd/IPcheck.c @@ -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)); diff --git a/ircd/ircd.c b/ircd/ircd.c index 2ed022b..754ecab 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -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. */ -- 2.20.1