Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Sep 2009 21:17:18 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r196995 - in head/sys: net netinet
Message-ID:  <200909082117.n88LHIeZ060345@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Tue Sep  8 21:17:17 2009
New Revision: 196995
URL: http://svn.freebsd.org/changeset/base/196995

Log:
  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

Modified:
  head/sys/net/route.h
  head/sys/netinet/if_ether.c
  head/sys/netinet/if_ether.h
  head/sys/netinet/in.c

Modified: head/sys/net/route.h
==============================================================================
--- head/sys/net/route.h	Tue Sep  8 20:45:40 2009	(r196994)
+++ head/sys/net/route.h	Tue Sep  8 21:17:17 2009	(r196995)
@@ -435,6 +435,7 @@ int	 rtrequest1_fib(int, struct rt_addri
 #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

Modified: head/sys/netinet/if_ether.c
==============================================================================
--- head/sys/netinet/if_ether.c	Tue Sep  8 20:45:40 2009	(r196994)
+++ head/sys/netinet/if_ether.c	Tue Sep  8 21:17:17 2009	(r196995)
@@ -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,

Modified: head/sys/netinet/if_ether.h
==============================================================================
--- head/sys/netinet/if_ether.h	Tue Sep  8 20:45:40 2009	(r196994)
+++ head/sys/netinet/if_ether.h	Tue Sep  8 21:17:17 2009	(r196995)
@@ -117,6 +117,11 @@ int	arpresolve(struct ifnet *ifp, struct
 		    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

Modified: head/sys/netinet/in.c
==============================================================================
--- head/sys/netinet/in.c	Tue Sep  8 20:45:40 2009	(r196994)
+++ head/sys/netinet/in.c	Tue Sep  8 21:17:17 2009	(r196995)
@@ -1418,6 +1418,7 @@ in_lltable_lookup(struct lltable *llt, u
 		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);	



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909082117.n88LHIeZ060345>