Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142230202
D50405.id155642.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D50405.id155642.diff
View Options
diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c
--- a/sys/net80211/ieee80211.c
+++ b/sys/net80211/ieee80211.c
@@ -564,7 +564,7 @@
ifp = if_alloc(IFT_ETHER);
if_initname(ifp, name, unit);
ifp->if_softc = vap; /* back pointer */
- ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST;
+ if_setflags(ifp, IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST);
ifp->if_transmit = ieee80211_vap_transmit;
ifp->if_qflush = ieee80211_vap_qflush;
ifp->if_ioctl = ieee80211_ioctl;
diff --git a/sys/net80211/ieee80211_freebsd.h b/sys/net80211/ieee80211_freebsd.h
--- a/sys/net80211/ieee80211_freebsd.h
+++ b/sys/net80211/ieee80211_freebsd.h
@@ -263,8 +263,8 @@
const char * ieee80211_get_vap_ifname(struct ieee80211vap *);
#define IFNET_IS_UP_RUNNING(_ifp) \
- (((_ifp)->if_flags & IFF_UP) && \
- ((_ifp)->if_drv_flags & IFF_DRV_RUNNING))
+ ((if_getflags(_ifp) & IFF_UP) && \
+ (if_getdrvflags(_ifp) & IFF_DRV_RUNNING))
#define msecs_to_ticks(ms) MSEC_2_TICKS(ms)
#define ticks_to_msecs(t) TICKS_2_MSEC(t)
@@ -543,6 +543,10 @@
void ieee80211_vap_sync_mac_address(struct ieee80211vap *);
void ieee80211_vap_copy_mac_address(struct ieee80211vap *);
void ieee80211_vap_deliver_data(struct ieee80211vap *, struct mbuf *);
+bool ieee80211_vap_check_is_monitor(struct ieee80211vap *);
+bool ieee80211_vap_check_is_simplex(struct ieee80211vap *);
+bool ieee80211_vap_check_is_running(struct ieee80211vap *);
+void ieee80211_vap_set_is_running(struct ieee80211vap *, bool);
#endif /* _KERNEL */
diff --git a/sys/net80211/ieee80211_freebsd.c b/sys/net80211/ieee80211_freebsd.c
--- a/sys/net80211/ieee80211_freebsd.c
+++ b/sys/net80211/ieee80211_freebsd.c
@@ -1259,6 +1259,71 @@
NET_EPOCH_EXIT(et);
}
+/**
+ * @brief Return whether the VAP is configured with monitor mode
+ *
+ * This checks the operating system layer for whether monitor mode
+ * is enabled.
+ *
+ * @param vap the current VAP
+ * @retval true if the underlying interface is in MONITOR mode, false otherwise
+ */
+bool
+ieee80211_vap_check_is_monitor(struct ieee80211vap *vap)
+{
+ struct ifnet *ifp = vap->iv_ifp;
+
+ return !! (if_getflags(ifp) & IFF_MONITOR);
+}
+
+/**
+ * @brief Return whether the VAP is configured in simplex mode.
+ *
+ * This checks the operating system layer for whether simplex mode
+ * is enabled.
+ *
+ * @param vap the current VAP
+ * @retval true if the underlying interface is in SIMPLEX mode, false otherwise
+ */
+bool
+ieee80211_vap_check_is_simplex(struct ieee80211vap *vap)
+{
+ struct ifnet *ifp = vap->iv_ifp;
+
+ return !! (if_getflags(ifp) & IFF_SIMPLEX);
+}
+
+/**
+ * @brief Return if the VAP underlying network interface is running
+ *
+ * @param vap the current VAP
+ * @retval true if the underlying interface is running; false otherwise
+ */
+bool
+ieee80211_vap_check_is_running(struct ieee80211vap *vap)
+{
+ struct ifnet *ifp = vap->iv_ifp;
+
+ return !! (if_getdrvflags(ifp) & IFF_DRV_RUNNING);
+}
+
+/**
+ * @brief Change the VAP underlying network interface state
+ *
+ * @param vap the current VAP
+ * @param state true to mark the interface as RUNNING, false to clear
+ */
+void
+ieee80211_vap_set_is_running(struct ieee80211vap *vap, bool state)
+{
+ struct ifnet *ifp = vap->iv_ifp;
+
+ if (state)
+ if_setdrvflagbits(ifp, IFF_DRV_RUNNING, 0);
+ else
+ if_setdrvflagbits(ifp, 0, IFF_DRV_RUNNING);
+}
+
/*
* Module glue.
*
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -3619,7 +3619,7 @@
wait = 1;
ieee80211_start_locked(vap);
}
- } else if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
+ } else if (ieee80211_vap_check_is_running(vap)) {
/*
* Stop ourself. If we are the last vap to be
* marked down the parent will also be taken down.
diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c
--- a/sys/net80211/ieee80211_output.c
+++ b/sys/net80211/ieee80211_output.c
@@ -777,7 +777,7 @@
if (error)
senderr(error);
#endif
- if (ifp->if_flags & IFF_MONITOR)
+ if (ieee80211_vap_check_is_monitor(vap))
senderr(ENETDOWN);
if (!IFNET_IS_UP_RUNNING(ifp))
senderr(ENETDOWN);
diff --git a/sys/net80211/ieee80211_proto.c b/sys/net80211/ieee80211_proto.c
--- a/sys/net80211/ieee80211_proto.c
+++ b/sys/net80211/ieee80211_proto.c
@@ -1976,7 +1976,6 @@
void
ieee80211_start_locked(struct ieee80211vap *vap)
{
- struct ifnet *ifp = vap->iv_ifp;
struct ieee80211com *ic = vap->iv_ic;
IEEE80211_LOCK_ASSERT(ic);
@@ -1985,7 +1984,7 @@
IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG,
"start running, %d vaps running\n", ic->ic_nrunning);
- if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
+ if (! ieee80211_vap_check_is_running(vap)) {
/*
* Mark us running. Note that it's ok to do this first;
* if we need to bring the parent device up we defer that
@@ -1994,7 +1993,7 @@
* through ieee80211_start_all at which point we'll come
* back in here and complete the work.
*/
- ifp->if_drv_flags |= IFF_DRV_RUNNING;
+ ieee80211_vap_set_is_running(vap, true);
ieee80211_notify_ifnet_change(vap, IFF_DRV_RUNNING);
/*
@@ -2099,7 +2098,6 @@
ieee80211_stop_locked(struct ieee80211vap *vap)
{
struct ieee80211com *ic = vap->iv_ic;
- struct ifnet *ifp = vap->iv_ifp;
IEEE80211_LOCK_ASSERT(ic);
@@ -2107,8 +2105,8 @@
"stop running, %d vaps running\n", ic->ic_nrunning);
ieee80211_new_state_locked(vap, IEEE80211_S_INIT, -1);
- if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
- ifp->if_drv_flags &= ~IFF_DRV_RUNNING; /* mark us stopped */
+ if (ieee80211_vap_check_is_running(vap)) {
+ ieee80211_vap_set_is_running(vap, false); /* mark us stopped */
ieee80211_notify_ifnet_change(vap, IFF_DRV_RUNNING);
if (--ic->ic_nrunning == 0) {
IEEE80211_DPRINTF(vap,
diff --git a/sys/net80211/ieee80211_sta.c b/sys/net80211/ieee80211_sta.c
--- a/sys/net80211/ieee80211_sta.c
+++ b/sys/net80211/ieee80211_sta.c
@@ -681,7 +681,7 @@
}
resubmit_ampdu:
if (dir == IEEE80211_FC1_DIR_FROMDS) {
- if ((ifp->if_flags & IFF_SIMPLEX) &&
+ if (ieee80211_vap_check_is_simplex(vap) &&
isfromds_mcastecho(vap, wh)) {
/*
* In IEEE802.11 network, multicast
@@ -716,7 +716,7 @@
vap->iv_stats.is_rx_wrongdir++;
goto out;
}
- if ((ifp->if_flags & IFF_SIMPLEX) &&
+ if (ieee80211_vap_check_is_simplex(vap) &&
isdstods_mcastecho(vap, wh)) {
/*
* In IEEE802.11 network, multicast
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 18, 1:56 PM (16 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27710231
Default Alt Text
D50405.id155642.diff (6 KB)
Attached To
Mode
D50405: net80211: migrate if_flags, if_drvflags out of most source files
Attached
Detach File
Event Timeline
Log In to Comment