summaryrefslogtreecommitdiffstats
path: root/sys/net/if.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2009-12-29 13:35:18 +0000
committerjhb <jhb@FreeBSD.org>2009-12-29 13:35:18 +0000
commit3ce93dcb7c6607b76d019f9acff610d5389f2b5a (patch)
treefffe65b8e28fab3d296215d907de7cf2e4433879 /sys/net/if.c
parentaa28c3213861962a9da4732d118054f285c25df9 (diff)
downloadFreeBSD-src-3ce93dcb7c6607b76d019f9acff610d5389f2b5a.zip
FreeBSD-src-3ce93dcb7c6607b76d019f9acff610d5389f2b5a.tar.gz
Change vlan interfaces to cope more usefully with the parent interface being
renamed. Previously the vlan interfaces would lose their configuration as if the parent interface had been physically removed. Now vlan interfaces ignore rename events. - Add a new ifnet flag (IFF_RENAMING) that is set while an ifnet is being renamed. This flag can be checked in ifnet departure/arrival event handlers to treat rename events differently. - Change the ifnet departure event handler in the if_vlan(4) driver to ignore departure events due to a trunk interface being renamed. Reviewed by: brooks, rwatson MFC after: 1 week
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 003f3ea..7029b9c 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -2095,6 +2095,14 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
return (EINVAL);
if (ifunit(new_name) != NULL)
return (EEXIST);
+
+ /*
+ * XXX: Locking. Nothing else seems to lock if_flags,
+ * and there are numerous other races with the
+ * ifunit() checks not being atomic with namespace
+ * changes (renames, vmoves, if_attach, etc).
+ */
+ ifp->if_flags |= IFF_RENAMING;
/* Announce the departure of the interface. */
rt_ifannouncemsg(ifp, IFAN_DEPARTURE);
@@ -2129,6 +2137,8 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
EVENTHANDLER_INVOKE(ifnet_arrival_event, ifp);
/* Announce the return of the interface. */
rt_ifannouncemsg(ifp, IFAN_ARRIVAL);
+
+ ifp->if_flags &= ~IFF_RENAMING;
break;
#ifdef VIMAGE
OpenPOWER on IntegriCloud