From: Felix Fietkau Date: Fri, 27 Aug 2010 19:34:16 +0000 (+0200) Subject: decrease host timeout, add more ping tries and make them configurable X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=931b54fa982bcc163009a3fe61cff5173aaa79d8;p=oweals%2Frelayd.git decrease host timeout, add more ping tries and make them configurable --- diff --git a/main.c b/main.c index e677f49..9361c97 100644 --- a/main.c +++ b/main.c @@ -36,6 +36,7 @@ LIST_HEAD(interfaces); int debug; static int host_timeout; +static int host_ping_tries; static int inet_sock; static int forward_bcast; static int forward_dhcp; @@ -244,7 +245,7 @@ static void host_entry_timeout(struct uloop_timeout *timeout) * When the timeout is reached, try pinging the host a few times before * giving up on it. */ - if (host->rif->managed && host->cleanup_pending < 2) { + if (host->rif->managed && host->cleanup_pending < host_ping_tries) { send_arp_request(host->rif, host->ipaddr); host->cleanup_pending++; uloop_timeout_set(&host->timeout, 1000); @@ -667,6 +668,7 @@ static int usage(const char *progname) " -R :/\n" " Add a static route for / via \n" " -t Host entry expiry timeout\n" + " -p Number of ARP ping attempts before considering a host dead\n" " -T Set routing table number for automatically added routes\n" " -B Enable broadcast forwarding\n" " -D Enable DHCP forwarding\n" @@ -694,7 +696,8 @@ int main(int argc, char **argv) return 1; } - host_timeout = 60; + host_timeout = 30; + host_ping_tries = 5; forward_bcast = 0; local_route_table = 0; uloop_init(); @@ -717,6 +720,11 @@ int main(int argc, char **argv) if (host_timeout <= 0) return usage(argv[0]); break; + case 'p': + host_ping_tries = atoi(optarg); + if (host_ping_tries <= 0) + return usage(argv[0]); + break; case 'd': debug++; break;