static uns max_banned_time = 86400;
static uns max_suspects = ~0U;
static uns max_banned = ~0U;
+static uns probation;
static char *ipv4_set;
static char *ipv6_set;
static char *config_log_stream;
CF_UNS("MaxSuspectTime", &max_suspect_time),
CF_UNS("MaxBannedTime", &max_banned_time),
CF_UNS("MaxFailures", &max_failures),
+ CF_UNS("Probation", &probation),
CF_STRING("IPv4Set", &ipv4_set),
CF_STRING("IPv6Set", &ipv6_set),
CF_STRING("LogStream", &config_log_stream),
break;
}
+ clist_remove(&c->n);
+ (*counter)--;
+
if (c->banned)
{
msg(L_INFO, "Unbanning %s", AFMT(c->addr));
is_modify(0, c->addr);
+ if (probation)
+ {
+ c->banned = 0;
+ c->last_fail = now;
+ c->fail_count = max_failures - probation;
+ clist_add_tail(&suspect_list, &c->n);
+ num_suspects++;
+ msg(L_DEBUG, "Suspect %s: probation, failures=%u", AFMT(c->addr), c->fail_count);
+ }
+ else
+ culprit_remove(c);
}
else
- msg(L_DEBUG, "Suspect %s: acquitted", AFMT(c->addr));
-
- clist_remove(&c->n);
- culprit_remove(c);
- (*counter)--;
+ {
+ msg(L_DEBUG, "Suspect %s: acquitted", AFMT(c->addr));
+ culprit_remove(c);
+ }
}
}
static void culprit_cleanup(void)
{
timestamp_t next_cleanup = main_get_now() + (timestamp_t)3600 * 1000;
- cleanup_list(&suspect_list, &num_suspects, (timestamp_t)max_suspect_time * 1000, max_suspects, &next_cleanup);
cleanup_list(&banned_list, &num_banned, (timestamp_t)max_banned_time * 1000, max_banned, &next_cleanup);
+ cleanup_list(&suspect_list, &num_suspects, (timestamp_t)max_suspect_time * 1000, max_suspects, &next_cleanup);
timer_add(&cleanup_timer, next_cleanup);
}