Add arp_update_event. This replaces route_arp_update_event, which
has not worked since the arp-v2 rewrite. The event handler will be called with the llentry write-locked and can examine la_flags to determine whether the entry is being added or removed. Reviewed by: gnn, kmacy Approved by: gnn (mentor) MFC after: 1 month
This commit is contained in:
parent
e645b495ed
commit
ba75578c03
@ -435,6 +435,7 @@ int rtrequest1_fib(int, struct rt_addrinfo *, struct rtentry **, u_int);
|
||||
#include <sys/eventhandler.h>
|
||||
typedef void (*rtevent_arp_update_fn)(void *, struct rtentry *, uint8_t *, struct sockaddr *);
|
||||
typedef void (*rtevent_redirect_fn)(void *, struct rtentry *, struct rtentry *, struct sockaddr *);
|
||||
/* route_arp_update_event is no longer generated; see arp_update_event */
|
||||
EVENTHANDLER_DECLARE(route_arp_update_event, rtevent_arp_update_fn);
|
||||
EVENTHANDLER_DECLARE(route_redirect_event, rtevent_redirect_fn);
|
||||
#endif
|
||||
|
@ -684,6 +684,8 @@ match:
|
||||
(void)memcpy(&la->ll_addr, ar_sha(ah), ifp->if_addrlen);
|
||||
la->la_flags |= LLE_VALID;
|
||||
|
||||
EVENTHANDLER_INVOKE(arp_update_event, la);
|
||||
|
||||
if (!(la->la_flags & LLE_STATIC)) {
|
||||
la->la_expire = time_uptime + V_arpt_keep;
|
||||
callout_reset(&la->la_timer, hz * V_arpt_keep,
|
||||
|
@ -117,6 +117,11 @@ int arpresolve(struct ifnet *ifp, struct rtentry *rt,
|
||||
struct llentry **lle);
|
||||
void arp_ifinit(struct ifnet *, struct ifaddr *);
|
||||
void arp_ifinit2(struct ifnet *, struct ifaddr *, u_char *);
|
||||
|
||||
#include <sys/eventhandler.h>
|
||||
typedef void (*llevent_arp_update_fn)(void *, struct llentry *);
|
||||
EVENTHANDLER_DECLARE(arp_update_event, llevent_arp_update_fn);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1418,6 +1418,7 @@ in_lltable_lookup(struct lltable *llt, u_int flags, const struct sockaddr *l3add
|
||||
if (!(lle->la_flags & LLE_IFADDR) || (flags & LLE_IFADDR)) {
|
||||
LLE_WLOCK(lle);
|
||||
lle->la_flags = LLE_DELETED;
|
||||
EVENTHANDLER_INVOKE(arp_update_event, lle);
|
||||
LLE_WUNLOCK(lle);
|
||||
#ifdef DIAGNOSTICS
|
||||
log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle);
|
||||
|
Loading…
x
Reference in New Issue
Block a user