diff options
author | glebius <glebius@FreeBSD.org> | 2010-11-30 16:14:19 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2010-11-30 16:14:19 +0000 |
commit | 87d14992592feabc42a5d50ae0dca07b22028468 (patch) | |
tree | 06530b76c952dede2af151df7f7370d000e2860d /usr.sbin/arp | |
parent | f3bd80afa1c8697faae1168f9d9c3573c41865ca (diff) | |
download | FreeBSD-src-87d14992592feabc42a5d50ae0dca07b22028468.zip FreeBSD-src-87d14992592feabc42a5d50ae0dca07b22028468.tar.gz |
Do not hardcode (20*60), but use current ARP timeout value configured
in kernel.
Diffstat (limited to 'usr.sbin/arp')
-rw-r--r-- | usr.sbin/arp/arp.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c index 26674de..59fbea8 100644 --- a/usr.sbin/arp/arp.c +++ b/usr.sbin/arp/arp.c @@ -320,8 +320,14 @@ set(int argc, char **argv) while (argc-- > 0) { if (strncmp(argv[0], "temp", 4) == 0) { struct timespec tp; + int max_age; + size_t len = sizeof(max_age); + clock_gettime(CLOCK_MONOTONIC, &tp); - expire_time = tp.tv_sec + 20 * 60; + if (sysctlbyname("net.link.ether.inet.max_age", + &max_age, &len, NULL, 0) != 0) + err(1, "sysctlbyname"); + expire_time = tp.tv_sec + max_age; } else if (strncmp(argv[0], "pub", 3) == 0) { flags |= RTF_ANNOUNCE; doing_proxy = 1; |