Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Aug 2009 19:18:21 +0000 (UTC)
From:      Marko Zec <zec@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r196624 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci net
Message-ID:  <200908281918.n7SJIL9I033980@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: zec
Date: Fri Aug 28 19:18:20 2009
New Revision: 196624
URL: http://svn.freebsd.org/changeset/base/196624

Log:
  MFC r196504:
  
    When moving ifnets from one vnet to another, and the ifnet
    has ifaddresses of AF_LINK type which thus have an embedded
    if_index "backpointer", we must update that if_index backpointer
    to reflect the new if_index that our ifnet just got assigned.
  
    This change affects only options VIMAGE builds.
  
    Submitted by: bz
    Reviewed by:  bz
    Approved by:  re (rwatson), julian (mentor)
  
  Approved by:	re (rwatson)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/net/if.c

Modified: stable/8/sys/net/if.c
==============================================================================
--- stable/8/sys/net/if.c	Fri Aug 28 19:15:17 2009	(r196623)
+++ stable/8/sys/net/if.c	Fri Aug 28 19:18:20 2009	(r196624)
@@ -570,6 +570,21 @@ if_attach_internal(struct ifnet *ifp, in
 		/* Reliably crash if used uninitialized. */
 		ifp->if_broadcastaddr = NULL;
 	}
+#ifdef VIMAGE
+	else {
+		/*
+		 * Update the interface index in the link layer address
+		 * of the interface.
+		 */
+		for (ifa = ifp->if_addr; ifa != NULL;
+		    ifa = TAILQ_NEXT(ifa, ifa_link)) {
+			if (ifa->ifa_addr->sa_family == AF_LINK) {
+				sdl = (struct sockaddr_dl *)ifa->ifa_addr;
+				sdl->sdl_index = ifp->if_index;
+			}
+		}
+	}
+#endif
 
 	IFNET_WLOCK();
 	TAILQ_INSERT_TAIL(&V_ifnet, ifp, if_link);



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