Use the iflladdr_event event to keep the mac address on the vap in sync with
the parent wirless interface. If the user passed in a mac address or it was autogenerated then flag this to avoid trashing it on update. This will fix wlan+lagg in a post vap world.
This commit is contained in:
parent
6117727b6c
commit
83fcb81283
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=202612
@ -440,6 +440,9 @@ ieee80211_vap_setup(struct ieee80211com *ic, struct ieee80211vap *vap,
|
||||
/* auto-enable s/w beacon miss support */
|
||||
if (flags & IEEE80211_CLONE_NOBEACONS)
|
||||
vap->iv_flags_ext |= IEEE80211_FEXT_SWBMISS;
|
||||
/* auto-generated or user supplied MAC address */
|
||||
if (flags & (IEEE80211_CLONE_BSSID|IEEE80211_CLONE_MACADDR))
|
||||
vap->iv_flags_ext |= IEEE80211_FEXT_UNIQMAC;
|
||||
/*
|
||||
* Enable various functionality by default if we're
|
||||
* capable; the driver can override us if it knows better.
|
||||
|
@ -730,6 +730,7 @@ ieee80211_load_module(const char *modname)
|
||||
}
|
||||
|
||||
static eventhandler_tag wlan_bpfevent;
|
||||
static eventhandler_tag wlan_ifllevent;
|
||||
|
||||
static void
|
||||
bpf_track(void *arg, struct ifnet *ifp, int dlt, int attach)
|
||||
@ -756,6 +757,33 @@ bpf_track(void *arg, struct ifnet *ifp, int dlt, int attach)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
wlan_iflladdr(void *arg __unused, struct ifnet *ifp)
|
||||
{
|
||||
struct ieee80211com *ic = ifp->if_l2com;
|
||||
struct ieee80211vap *vap, *next;
|
||||
|
||||
if (ifp->if_type != IFT_IEEE80211 || ic == NULL)
|
||||
return;
|
||||
|
||||
IEEE80211_LOCK(ic);
|
||||
TAILQ_FOREACH_SAFE(vap, &ic->ic_vaps, iv_next, next) {
|
||||
/*
|
||||
* If the MAC address has changed on the parent and it was
|
||||
* copied to the vap on creation then re-sync.
|
||||
*/
|
||||
if (vap->iv_ic == ic &&
|
||||
(vap->iv_flags_ext & IEEE80211_FEXT_UNIQMAC) == 0) {
|
||||
IEEE80211_ADDR_COPY(vap->iv_myaddr, IF_LLADDR(ifp));
|
||||
IEEE80211_UNLOCK(ic);
|
||||
if_setlladdr(vap->iv_ifp, IF_LLADDR(ifp),
|
||||
IEEE80211_ADDR_LEN);
|
||||
IEEE80211_LOCK(ic);
|
||||
}
|
||||
}
|
||||
IEEE80211_UNLOCK(ic);
|
||||
}
|
||||
|
||||
/*
|
||||
* Module glue.
|
||||
*
|
||||
@ -772,6 +800,12 @@ wlan_modevent(module_t mod, int type, void *unused)
|
||||
bpf_track, 0, EVENTHANDLER_PRI_ANY);
|
||||
if (wlan_bpfevent == NULL)
|
||||
return ENOMEM;
|
||||
wlan_ifllevent = EVENTHANDLER_REGISTER(iflladdr_event,
|
||||
wlan_iflladdr, NULL, EVENTHANDLER_PRI_ANY);
|
||||
if (wlan_ifllevent == NULL) {
|
||||
EVENTHANDLER_DEREGISTER(bpf_track, wlan_bpfevent);
|
||||
return ENOMEM;
|
||||
}
|
||||
if_clone_attach(&wlan_cloner);
|
||||
if_register_com_alloc(IFT_IEEE80211, wlan_alloc, wlan_free);
|
||||
return 0;
|
||||
@ -779,6 +813,7 @@ wlan_modevent(module_t mod, int type, void *unused)
|
||||
if_deregister_com_alloc(IFT_IEEE80211);
|
||||
if_clone_detach(&wlan_cloner);
|
||||
EVENTHANDLER_DEREGISTER(bpf_track, wlan_bpfevent);
|
||||
EVENTHANDLER_DEREGISTER(iflladdr_event, wlan_ifllevent);
|
||||
return 0;
|
||||
}
|
||||
return EINVAL;
|
||||
|
@ -545,11 +545,12 @@ MALLOC_DECLARE(M_80211_VAP);
|
||||
/* NB: immutable: should be set only when creating a vap */
|
||||
#define IEEE80211_FEXT_WDSLEGACY 0x00010000 /* CONF: legacy WDS operation */
|
||||
#define IEEE80211_FEXT_PROBECHAN 0x00020000 /* CONF: probe passive channel*/
|
||||
#define IEEE80211_FEXT_UNIQMAC 0x00040000 /* CONF: user or computed mac */
|
||||
|
||||
#define IEEE80211_FEXT_BITS \
|
||||
"\20\2INACT\3SCANWAIT\4BGSCAN\5WPS\6TSN\7SCANREQ\10RESUME" \
|
||||
"\0114ADDR\12NONEPR_PR\13SWBMISS\14DFS\15DOTD\16STATEWAIT\17REINIT" \
|
||||
"\20BPF\21WDSLEGACY\22PROBECHAN"
|
||||
"\20BPF\21WDSLEGACY\22PROBECHAN\23UNIQMAC"
|
||||
|
||||
/* ic_flags_ht/iv_flags_ht */
|
||||
#define IEEE80211_FHT_NONHT_PR 0x00000001 /* STATUS: non-HT sta present */
|
||||
|
Loading…
Reference in New Issue
Block a user