- /* setting a tkline, or existing one is perm */
- if(tkline || ((aconf->flags & CONF_FLAGS_TEMPORARY) == 0))
- {
- reason = aconf->passwd ? aconf->passwd : "<No Reason>";
+ /* The above was really a lookup of a single IP,
+ * so check if the new kline is wider than the
+ * existing one.
+ * -- jilles
+ */
+ p = strchr(aconf->host, '/');
+ if (bits > 0 && (p == NULL || bits < atoi(p + 1)))
+ aconf = NULL;
+ }
+ }
+ if (aconf != NULL)
+ {
+ /* setting a tkline, or existing one is perm */
+ if(tkline || ((aconf->flags & CONF_FLAGS_TEMPORARY) == 0))
+ {
+ reason = aconf->passwd ? aconf->passwd : "<No Reason>";