summaryrefslogtreecommitdiffstats
path: root/sys/net/if.c
diff options
context:
space:
mode:
authorzec <zec@FreeBSD.org>2009-08-24 10:14:09 +0000
committerzec <zec@FreeBSD.org>2009-08-24 10:14:09 +0000
commit47445e571bb87efe6c9621022f2d327bdf40b28d (patch)
tree21b0e5b3c733b468b9bfe998b6bcd241f88be03e /sys/net/if.c
parent19bb42c4683c0b8129df0c1807d6980d4535679d (diff)
downloadFreeBSD-src-47445e571bb87efe6c9621022f2d327bdf40b28d.zip
FreeBSD-src-47445e571bb87efe6c9621022f2d327bdf40b28d.tar.gz
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)
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index fe497d6..a1155cd 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -589,6 +589,21 @@ if_attach_internal(struct ifnet *ifp, int vmove)
/* 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);
OpenPOWER on IntegriCloud