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/e42360aa378c
branches:  trunk
changeset: 360978:e42360aa378c
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 a0786433c81a -r e42360aa378c 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
@@ -830,6 +830,7 @@
 
 #if __NetBSD__
        if_register(ifp);
+       ieee80211_link_state_change(vap);
 #endif
 
        return 1;
diff -r a0786433c81a -r e42360aa378c 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 a0786433c81a -r e42360aa378c 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 a0786433c81a -r e42360aa378c 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