[net80211] Add a method to return the vap's ifname.

This removes the requirement to know what's in the ifp.

(If someone wants a quick clean-up task, it'd be nice to convert instances
of ifp dereferencing for if_xname over to this method.)
This commit is contained in:
Adrian Chadd 2020-06-07 04:57:48 +00:00
parent 3a4d70c588
commit 24a366af3a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=361885
2 changed files with 15 additions and 0 deletions

View File

@ -1033,6 +1033,20 @@ wlan_iflladdr(void *arg __unused, struct ifnet *ifp)
}
}
/*
* Fetch the VAP name.
*
* This returns a const char pointer suitable for debugging,
* but don't expect it to stick around for much longer.
*/
const char *
ieee80211_get_vap_ifname(struct ieee80211vap *vap)
{
if ((vap->iv_ifp == NULL) || (vap->iv_ifp->if_xname == NULL))
return "(none)";
return vap->iv_ifp->if_xname;
}
/*
* Module glue.
*

View File

@ -245,6 +245,7 @@ void ieee80211_drain_ifq(struct ifqueue *);
void ieee80211_flush_ifq(struct ifqueue *, struct ieee80211vap *);
void ieee80211_vap_destroy(struct ieee80211vap *);
const char * ieee80211_get_vap_ifname(struct ieee80211vap *);
#define IFNET_IS_UP_RUNNING(_ifp) \
(((_ifp)->if_flags & IFF_UP) && \