diff options
author | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2014-01-14 18:10:10 +0000 |
---|---|---|
committer | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2014-01-14 18:10:10 +0000 |
commit | f6ce20726b517875f98a2238fe247635626cfd40 (patch) | |
tree | b57a726aee93004681718abfba26a771f9a5ae77 /src/client.c | |
parent | c45beadd12c70ddb0d43a99a3c1ac66c8f965533 (diff) |
- Greatly speedup k-/g-line lookup. Instead of testing every single client against
every single k-/g-line just check the just added ban against connected clients.
- Renamed ban_them() to conf_try_ban()
- conf_try_ban() removed exemption notices that are now redundant
- hostmask.c:parse_netmask(): optimize for the ipv4 case
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/branches/8.1.x@2815 82007160-df01-0410-b94d-b575c5fd34c7
Diffstat (limited to 'src/client.c')
-rw-r--r-- | src/client.c | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/src/client.c b/src/client.c index 4350e14..f79685f 100644 --- a/src/client.c +++ b/src/client.c @@ -76,7 +76,6 @@ static dlink_node *eac_next; /* next aborted client to exit */ static void check_pings_list(dlink_list *); static void check_unknowns_list(void); -static void ban_them(struct Client *, struct MaskItem *); /* client_init() @@ -358,7 +357,7 @@ check_conf_klines(void) if (conf->type == CONF_EXEMPT) continue; - ban_them(client_p, conf); + conf_try_ban(client_p, conf); continue; /* and go examine next fd/client_p */ } @@ -368,16 +367,7 @@ check_conf_klines(void) CONF_GLINE, client_p->localClient->aftype, client_p->username, NULL, 1))) { - if (IsExemptKline(client_p) || - IsExemptGline(client_p)) - { - sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, - "GLINE over-ruled for %s, client is %sline_exempt", - get_client_name(client_p, HIDE_IP), IsExemptKline(client_p) ? "k" : "g"); - continue; - } - - ban_them(client_p, conf); + conf_try_ban(client_p, conf); /* and go examine next fd/client_p */ continue; } @@ -387,22 +377,14 @@ check_conf_klines(void) CONF_KLINE, client_p->localClient->aftype, client_p->username, NULL, 1))) { - if (IsExemptKline(client_p)) - { - sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, - "KLINE over-ruled for %s, client is kline_exempt", - get_client_name(client_p, HIDE_IP)); - continue; - } - - ban_them(client_p, conf); + conf_try_ban(client_p, conf); continue; } if ((conf = find_matching_name_conf(CONF_XLINE, client_p->info, NULL, NULL, 0))) { - ban_them(client_p, conf); + conf_try_ban(client_p, conf); continue; } } @@ -424,15 +406,15 @@ check_conf_klines(void) } /* - * ban_them + * conf_try_ban * * inputs - pointer to client to ban * - pointer to MaskItem * output - NONE * side effects - given client_p is banned */ -static void -ban_them(struct Client *client_p, struct MaskItem *conf) +void +conf_try_ban(struct Client *client_p, struct MaskItem *conf) { const char *user_reason = NULL; /* What is sent to user */ const char *type_string = NULL; @@ -444,12 +426,29 @@ ban_them(struct Client *client_p, struct MaskItem *conf) switch (conf->type) { case CONF_KLINE: + if (IsExemptKline(client_p)) + { + sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, + "KLINE over-ruled for %s, client is kline_exempt", + get_client_name(client_p, HIDE_IP)); + return; + } + type_string = kline_string; break; case CONF_DLINE: type_string = dline_string; break; case CONF_GLINE: + if (IsExemptKline(client_p) || + IsExemptGline(client_p)) + { + sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, + "GLINE over-ruled for %s, client is %sline_exempt", + get_client_name(client_p, HIDE_IP), IsExemptKline(client_p) ? "k" : "g"); + return; + } + type_string = gline_string; break; case CONF_XLINE: |