diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-01-13 12:16:19 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-01-13 12:16:19 +0000 |
commit | 07d00e707c98be1e3a92287fc35249429d143149 (patch) | |
tree | 8848f41f8a9582aeb453fb84c41b066d2d58659b | |
parent | db29a39694f8c1fa058bbb893f4d8253c3336593 (diff) |
Only notify userland about resolved ARP entries if the Ethernet address
changed or if we asked for it.
Should reduce the RTM_RESOLVE storm seeing by claudio@
With inputs from and ok mikeb@
-rw-r--r-- | sys/netinet/if_ether.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 4f70ce698d0..01458833ac9 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.c,v 1.140 2015/01/08 14:29:18 mpi Exp $ */ +/* $OpenBSD: if_ether.c,v 1.141 2015/01/13 12:16:18 mpi Exp $ */ /* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */ /* @@ -560,7 +560,7 @@ in_arpinput(struct mbuf *m) u_int8_t *ether_shost = NULL; #endif char addr[INET_ADDRSTRLEN]; - int op; + int op, changed = 0; ea = mtod(m, struct ether_arp *); op = ntohs(ea->arp_op); @@ -684,6 +684,7 @@ in_arpinput(struct mbuf *m) ac->ac_if.if_xname); rt->rt_expire = 1; /* no longer static */ } + changed = 1; } } else if (rt->rt_ifp != &ac->ac_if && #if NBRIDGE > 0 @@ -711,8 +712,10 @@ in_arpinput(struct mbuf *m) if (rt->rt_expire) rt->rt_expire = time_second + arpt_keep; rt->rt_flags &= ~RTF_REJECT; + /* Notify userland that an ARP resolution has been done. */ + if (la->la_asked || changed) + rt_sendmsg(rt, RTM_RESOLVE, rt->rt_ifp->if_rdomain); la->la_asked = 0; - rt_sendmsg(rt, RTM_RESOLVE, rt->rt_ifp->if_rdomain); while ((mh = la->la_hold_head) != NULL) { if ((la->la_hold_head = mh->m_nextpkt) == NULL) la->la_hold_tail = NULL; |