svn commit: r252924 - stable/9/sys/netinet

Michael Tuexen tuexen at FreeBSD.org
Sun Jul 7 11:20:13 UTC 2013


Author: tuexen
Date: Sun Jul  7 11:20:12 2013
New Revision: 252924
URL: http://svnweb.freebsd.org/changeset/base/252924

Log:
  MFC r239035:
  Testing an interface property should depend on the interface, not
  on an address.

Modified:
  stable/9/sys/netinet/sctp_bsd_addr.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/netinet/sctp_bsd_addr.c
==============================================================================
--- stable/9/sys/netinet/sctp_bsd_addr.c	Sun Jul  7 11:15:54 2013	(r252923)
+++ stable/9/sys/netinet/sctp_bsd_addr.c	Sun Jul  7 11:20:12 2013	(r252924)
@@ -152,12 +152,12 @@ sctp_gather_internal_ifa_flags(struct sc
 
 
 static uint32_t
-sctp_is_desired_interface_type(struct ifaddr *ifa)
+sctp_is_desired_interface_type(struct ifnet *ifn)
 {
 	int result;
 
 	/* check the interface type to see if it's one we care about */
-	switch (ifa->ifa_ifp->if_type) {
+	switch (ifn->if_type) {
 	case IFT_ETHER:
 	case IFT_ISO88023:
 	case IFT_ISO88024:
@@ -216,6 +216,10 @@ sctp_init_ifns_for_vrf(int vrfid)
 
 	IFNET_RLOCK();
 	TAILQ_FOREACH(ifn, &MODULE_GLOBAL(ifnet), if_list) {
+		if (sctp_is_desired_interface_type(ifn) == 0) {
+			/* non desired type */
+			continue;
+		}
 		IF_ADDR_RLOCK(ifn);
 		TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) {
 			if (ifa->ifa_addr == NULL) {
@@ -240,10 +244,6 @@ sctp_init_ifns_for_vrf(int vrfid)
 			default:
 				continue;
 			}
-			if (sctp_is_desired_interface_type(ifa) == 0) {
-				/* non desired type */
-				continue;
-			}
 			switch (ifa->ifa_addr->sa_family) {
 #ifdef INET
 			case AF_INET:
@@ -317,6 +317,10 @@ sctp_addr_change(struct ifaddr *ifa, int
 	if (ifa->ifa_addr == NULL) {
 		return;
 	}
+	if (sctp_is_desired_interface_type(ifa->ifa_ifp) == 0) {
+		/* non desired type */
+		return;
+	}
 	switch (ifa->ifa_addr->sa_family) {
 #ifdef INET
 	case AF_INET:
@@ -338,22 +342,16 @@ sctp_addr_change(struct ifaddr *ifa, int
 		/* non inet/inet6 skip */
 		return;
 	}
-
-	if (sctp_is_desired_interface_type(ifa) == 0) {
-		/* non desired type */
-		return;
-	}
 	if (cmd == RTM_ADD) {
 		(void)sctp_add_addr_to_vrf(SCTP_DEFAULT_VRFID, (void *)ifa->ifa_ifp,
-		    ifa->ifa_ifp->if_index, ifa->ifa_ifp->if_type,
-		    ifa->ifa_ifp->if_xname,
+		    ifa->ifa_ifp->if_index, ifa->ifa_ifp->if_type, ifa->ifa_ifp->if_xname,
 		    (void *)ifa, ifa->ifa_addr, ifa_flags, 1);
 	} else {
 
 		sctp_del_addr_from_vrf(SCTP_DEFAULT_VRFID, ifa->ifa_addr,
 		    ifa->ifa_ifp->if_index,
-		    ifa->ifa_ifp->if_xname
-		    );
+		    ifa->ifa_ifp->if_xname);
+
 		/*
 		 * We don't bump refcount here so when it completes the
 		 * final delete will happen.


More information about the svn-src-all mailing list