FreeBSD Bugzilla – Attachment 103069 Details for
Bug 142927
[vlan] [patch] handle parent interface link layer address changes in if_vlan(4)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 4.56 KB, created by
Nikolay Denev
on 2010-01-18 06:00:16 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Nikolay Denev
Created:
2010-01-18 06:00:16 UTC
Size:
4.56 KB
patch
obsolete
>diff -ru .zfs/snapshot/orig/sys/net/if.c sys/net/if.c >--- .zfs/snapshot/orig/sys/net/if.c 2010-01-11 08:14:58.274826988 +0200 >+++ sys/net/if.c 2010-01-15 11:23:40.194343979 +0200 >@@ -2341,6 +2341,7 @@ > return (error); > error = if_setlladdr(ifp, > ifr->ifr_addr.sa_data, ifr->ifr_addr.sa_len); >+ EVENTHANDLER_INVOKE(iflladdr_event, ifp); > break; > > case SIOCAIFGROUP: >diff -ru .zfs/snapshot/orig/sys/net/if_bridge.c sys/net/if_bridge.c >--- .zfs/snapshot/orig/sys/net/if_bridge.c 2009-09-09 23:39:06.796873085 +0300 >+++ sys/net/if_bridge.c 2010-01-16 17:10:43.754373955 +0200 >@@ -915,6 +915,7 @@ > IF_LLADDR(sc->sc_ifp), ETHER_ADDR_LEN); > sc->sc_ifaddr = fif; > } >+ EVENTHANDLER_INVOKE(iflladdr_event, sc->sc_ifp); > } > > bridge_mutecaps(sc); /* recalcuate now this interface is removed */ >@@ -1031,6 +1032,7 @@ > !memcmp(IF_LLADDR(sc->sc_ifp), sc->sc_defaddr, ETHER_ADDR_LEN)) { > bcopy(IF_LLADDR(ifs), IF_LLADDR(sc->sc_ifp), ETHER_ADDR_LEN); > sc->sc_ifaddr = ifs; >+ EVENTHANDLER_INVOKE(iflladdr_event, sc->sc_ifp); > } > > ifs->if_bridge = sc; >diff -ru .zfs/snapshot/orig/sys/net/if_lagg.c sys/net/if_lagg.c >--- .zfs/snapshot/orig/sys/net/if_lagg.c 2009-08-24 07:32:17.222829477 +0300 >+++ sys/net/if_lagg.c 2010-01-16 17:04:04.012810623 +0200 >@@ -303,6 +303,7 @@ > /* Let the protocol know the MAC has changed */ > if (sc->sc_lladdr != NULL) > (*sc->sc_lladdr)(sc); >+ EVENTHANDLER_INVOKE(iflladdr_event, ifp); > } > > static void >diff -ru .zfs/snapshot/orig/sys/net/if_var.h sys/net/if_var.h >--- .zfs/snapshot/orig/sys/net/if_var.h 2010-01-11 08:14:58.845828172 +0200 >+++ sys/net/if_var.h 2010-01-15 11:19:31.291719218 +0200 >@@ -341,6 +341,9 @@ > } while(0) > > #ifdef _KERNEL >+/* interface link layer address change event */ >+typedef void (*iflladdr_event_handler_t)(void *, struct ifnet *); >+EVENTHANDLER_DECLARE(iflladdr_event, iflladdr_event_handler_t); > /* interface address change event */ > typedef void (*ifaddr_event_handler_t)(void *, struct ifnet *); > EVENTHANDLER_DECLARE(ifaddr_event, ifaddr_event_handler_t); >diff -ru .zfs/snapshot/orig/sys/net/if_vlan.c sys/net/if_vlan.c >--- .zfs/snapshot/orig/sys/net/if_vlan.c 2010-01-11 08:14:58.882827943 +0200 >+++ sys/net/if_vlan.c 2010-01-17 23:27:24.830200364 +0200 >@@ -138,6 +138,7 @@ > static MALLOC_DEFINE(M_VLAN, VLANNAME, "802.1Q Virtual LAN Interface"); > > static eventhandler_tag ifdetach_tag; >+static eventhandler_tag iflladdr_tag; > > /* > * We have a global mutex, that is used to serialize configuration >@@ -199,6 +200,7 @@ > static int vlan_clone_destroy(struct if_clone *, struct ifnet *); > > static void vlan_ifdetach(void *arg, struct ifnet *ifp); >+static void vlan_iflladdr(void *arg, struct ifnet *ifp); > > static struct if_clone vlan_cloner = IFC_CLONE_INITIALIZER(VLANNAME, NULL, > IF_MAXUNIT, NULL, vlan_clone_match, vlan_clone_create, vlan_clone_destroy); >@@ -463,6 +465,41 @@ > } > > /* >+ * A handler for parent interface link layer address changes. >+ * If the parent interface link layer address is changed we >+ * should also change it on all children vlans. >+ */ >+static void >+vlan_iflladdr(void *arg __unused, struct ifnet *ifp) >+{ >+ struct ifvlan *ifv; >+ int i; >+ >+ /* >+ * Check if it's a trunk interface first of all >+ * to avoid needless locking. >+ */ >+ if (ifp->if_vlantrunk == NULL) >+ return; >+ >+ VLAN_LOCK(); >+ /* >+ * OK, it's a trunk. Loop over and change all vlan's lladdrs on it. >+ */ >+#ifdef VLAN_ARRAY >+ for (i = 0; i < VLAN_ARRAY_SIZE; i++) >+ if ((ifv = ifp->if_vlantrunk->vlans[i])) >+ if_setlladdr(ifv->ifv_ifp, IF_LLADDR(ifp), ETHER_ADDR_LEN); >+#else /* VLAN_ARRAY */ >+ for (i = 0; i < (1 << ifp->if_vlantrunk->hwidth); i++) >+ LIST_FOREACH(ifv, &ifp->if_vlantrunk->hash[i], ifv_list) >+ if_setlladdr(ifv->ifv_ifp, IF_LLADDR(ifp), ETHER_ADDR_LEN); >+#endif /* VLAN_ARRAY */ >+ VLAN_UNLOCK(); >+ >+} >+ >+/* > * A handler for network interface departure events. > * Track departure of trunks here so that we don't access invalid > * pointers or whatever if a trunk is ripped from under us, e.g., >@@ -537,6 +574,10 @@ > vlan_ifdetach, NULL, EVENTHANDLER_PRI_ANY); > if (ifdetach_tag == NULL) > return (ENOMEM); >+ iflladdr_tag = EVENTHANDLER_REGISTER(iflladdr_event, >+ vlan_iflladdr, NULL, EVENTHANDLER_PRI_ANY); >+ if (iflladdr_tag == NULL) >+ return (ENOMEM); > VLAN_LOCK_INIT(); > vlan_input_p = vlan_input; > vlan_link_state_p = vlan_link_state; >@@ -555,6 +596,7 @@ > case MOD_UNLOAD: > if_clone_detach(&vlan_cloner); > EVENTHANDLER_DEREGISTER(ifnet_departure_event, ifdetach_tag); >+ EVENTHANDLER_DEREGISTER(iflladdr_event, iflladdr_tag); > vlan_input_p = NULL; > vlan_link_state_p = NULL; > vlan_trunk_cap_p = NULL;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 142927
: 103069