Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src-draft/trunk]: src/sys/net80211 Re-do ieee80211 link state notifications.



details:   https://anonhg.NetBSD.org/src-all/rev/aa36444cb458
branches:  trunk
changeset: 951833:aa36444cb458
user:      Martin Husemann <martin%NetBSD.org@localhost>
date:      Thu Oct 08 21:31:05 2020 +0200

description:
Re-do ieee80211 link state notifications.

diffstat:

 sys/net80211/ieee80211.c        |   1 +
 sys/net80211/ieee80211_netbsd.c |  24 ++++++++++++++++++++++++
 sys/net80211/ieee80211_netbsd.h |   1 +
 sys/net80211/ieee80211_proto.c  |   5 +++++
 4 files changed, 31 insertions(+), 0 deletions(-)

diffs (68 lines):

diff -r 1b65055286c2 -r aa36444cb458 sys/net80211/ieee80211.c
--- a/sys/net80211/ieee80211.c  Thu Oct 08 20:27:33 2020 +0200
+++ b/sys/net80211/ieee80211.c  Thu Oct 08 21:31:05 2020 +0200
@@ -831,6 +831,7 @@
 
 #if __NetBSD__
        if_register(ifp);
+       ieee80211_link_state_change(vap);
 #endif
 
        return 1;
diff -r 1b65055286c2 -r aa36444cb458 sys/net80211/ieee80211_netbsd.c
--- a/sys/net80211/ieee80211_netbsd.c   Thu Oct 08 20:27:33 2020 +0200
+++ b/sys/net80211/ieee80211_netbsd.c   Thu Oct 08 21:31:05 2020 +0200
@@ -1551,3 +1551,27 @@
        ifp->if_broadcastaddr = etherbroadcastaddr;
        bpf_attach(ifp, DLT_EN10MB, sizeof(struct ether_header));
 }
+
+void
+ieee80211_link_state_change(struct ieee80211vap *vap)
+{
+       struct ifnet *ifp = vap->iv_ifp;
+
+       /*
+        * Link state does not make sense in IBSS or HOSTAP modes.
+        * We know that the link in MONITOR mode is DOWN as we cannot
+        * transmit, only monitor.
+        * That leaves BSS mode, which starts off DOWN and will
+        * transition to UP when it joins a node.
+        */
+       switch (vap->iv_opmode) {
+       case IEEE80211_M_AHDEMO:
+       case IEEE80211_M_HOSTAP:
+       case IEEE80211_M_IBSS:
+               if_link_state_change(ifp, LINK_STATE_UNKNOWN);
+               break;
+       default:
+               if_link_state_change(ifp, LINK_STATE_DOWN);
+               break;
+       }
+}
diff -r 1b65055286c2 -r aa36444cb458 sys/net80211/ieee80211_netbsd.h
--- a/sys/net80211/ieee80211_netbsd.h   Thu Oct 08 20:27:33 2020 +0200
+++ b/sys/net80211/ieee80211_netbsd.h   Thu Oct 08 21:31:05 2020 +0200
@@ -1026,6 +1026,7 @@
 }
 
 int ieee80211_activate(struct ieee80211com *, enum devact act);
+void ieee80211_link_state_change(struct ieee80211vap*);
 
 /*-
  * Macro for type conversion: convert mbuf pointer to data pointer of correct
diff -r 1b65055286c2 -r aa36444cb458 sys/net80211/ieee80211_proto.c
--- a/sys/net80211/ieee80211_proto.c    Thu Oct 08 20:27:33 2020 +0200
+++ b/sys/net80211/ieee80211_proto.c    Thu Oct 08 21:31:05 2020 +0200
@@ -2284,6 +2284,11 @@
                 * XXX TODO: ic/vap queue flush
                 */
        }
+
+#if __NetBSD__
+       ieee80211_link_state_change(vap);
+#endif
+
 done:
        IEEE80211_UNLOCK(ic);
 }



Home | Main Index | Thread Index | Old Index