From: chris Date: Tue, 28 Jun 2016 17:18:24 +0000 (+0000) Subject: Add sysctl for arp timers: net.inet.ip.arptimeout (expire timer for resolved X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4faff50f44a51e665f7e708eff244f1d4aad4a6d;p=openbsd Add sysctl for arp timers: net.inet.ip.arptimeout (expire timer for resolved entries) and net.inet.ip.arpdown (expire timer for unresolved entries) ok mpi@ --- diff --git a/lib/libc/gen/sysctl.3 b/lib/libc/gen/sysctl.3 index e36caafeee3..bd924636ed3 100644 --- a/lib/libc/gen/sysctl.3 +++ b/lib/libc/gen/sysctl.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sysctl.3,v 1.263 2016/06/18 22:19:13 jmc Exp $ +.\" $OpenBSD: sysctl.3,v 1.264 2016/06/28 17:18:24 chris Exp $ .\" .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: June 18 2016 $ +.Dd $Mdocdate: June 28 2016 $ .Dt SYSCTL 3 .Os .Sh NAME @@ -1148,6 +1148,8 @@ The currently defined protocols and names are: .It icmp Ta redirtimeout Ta integer Ta yes .It icmp Ta stats Ta structure Ta no .It icmp Ta tstamprepl Ta integer Ta yes +.It ip Ta arpdown Ta integer Ta yes +.It ip Ta arptimeout Ta integer Ta yes .It ip Ta directed-broadcast Ta integer Ta yes .It ip Ta encdebug Ta integer Ta yes .It ip Ta forwarding Ta integer Ta yes @@ -1309,6 +1311,10 @@ Returns the ICMP statistics in a struct icmpstat. .It Li icmp.tstamprepl If set to 1, reply to ICMP timestamp requests. If set to 0, ignore timestamp requests. +.It Li ip.arpdown +Lifetime of unresolved ARP entries, in seconds. +.It Li ip.arptimeout +Lifetime of resolved ARP entries, in seconds. .It Li ip.directed-broadcast Returns 1 if directed broadcast behavior is enabled for the host. .It Li ip.encdebug diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 284571bb467..31ef3eff061 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.c,v 1.215 2016/06/14 09:44:41 mpi Exp $ */ +/* $OpenBSD: if_ether.c,v 1.216 2016/06/28 17:18:24 chris Exp $ */ /* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */ /* @@ -74,8 +74,8 @@ struct llinfo_arp { #define LA_HOLD_TOTAL 100 /* timer values */ -int arpt_prune = (5*60*1); /* walk list every 5 minutes */ -int arpt_keep = (20*60); /* once resolved, good for 20 more minutes */ +int arpt_prune = (5 * 60); /* walk list every 5 minutes */ +int arpt_keep = (20 * 60); /* once resolved, cache for 20 minutes */ int arpt_down = 20; /* once declared down, don't send for 20 secs */ void arptfree(struct rtentry *); diff --git a/sys/netinet/if_ether.h b/sys/netinet/if_ether.h index 56e52bd79fa..279632102f8 100644 --- a/sys/netinet/if_ether.h +++ b/sys/netinet/if_ether.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.h,v 1.71 2016/05/18 20:15:14 mpi Exp $ */ +/* $OpenBSD: if_ether.h,v 1.72 2016/06/28 17:18:24 chris Exp $ */ /* $NetBSD: if_ether.h,v 1.22 1996/05/11 13:00:00 mycroft Exp $ */ /* @@ -202,6 +202,9 @@ struct arpcom { }; +extern int arpt_keep; /* arp resolved cache expire */ +extern int arpt_down; /* arp down cache expire */ + extern u_int8_t etherbroadcastaddr[ETHER_ADDR_LEN]; extern u_int8_t etheranyaddr[ETHER_ADDR_LEN]; extern u_int8_t ether_ipmulticast_min[ETHER_ADDR_LEN]; diff --git a/sys/netinet/in.h b/sys/netinet/in.h index 7859ca27614..31b2a26b453 100644 --- a/sys/netinet/in.h +++ b/sys/netinet/in.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in.h,v 1.116 2016/06/15 19:39:34 gerhard Exp $ */ +/* $OpenBSD: in.h,v 1.117 2016/06/28 17:18:24 chris Exp $ */ /* $NetBSD: in.h,v 1.20 1996/02/13 23:41:47 christos Exp $ */ /* @@ -682,7 +682,9 @@ struct ip_mreq { #define IPCTL_ARPQUEUED 36 #define IPCTL_MRTMFC 37 #define IPCTL_MRTVIF 38 -#define IPCTL_MAXID 39 +#define IPCTL_ARPTIMEOUT 39 +#define IPCTL_ARPDOWN 40 +#define IPCTL_MAXID 41 #define IPCTL_NAMES { \ { 0, 0 }, \ @@ -724,6 +726,8 @@ struct ip_mreq { { "arpqueued", CTLTYPE_INT }, \ { "mrtmfc", CTLTYPE_STRUCT }, \ { "mrtvif", CTLTYPE_STRUCT }, \ + { "arptimeout", CTLTYPE_INT }, \ + { "arpdown", CTLTYPE_INT }, \ } #define IPCTL_VARS { \ NULL, \ @@ -765,6 +769,8 @@ struct ip_mreq { &la_hold_total, \ NULL, \ NULL, \ + &arpt_keep, \ + &arpt_down, \ } #endif /* __BSD_VISIBLE */