Source-Changes-HG archive

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

[src-draft/trunk]: src/sys/net80211 Allow ieee 802.11 debug output to optiona...



details:   https://anonhg.NetBSD.org/src-all/rev/220ef22b0dcf
branches:  trunk
changeset: 377875:220ef22b0dcf
user:      Martin Husemann <martin%NetBSD.org@localhost>
date:      Tue Dec 29 16:33:08 2020 +0100

description:
Allow ieee 802.11 debug output to optionaly go to the console.

diffstat:

 sys/net80211/ieee80211_netbsd.c |  25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diffs (49 lines):

diff -r ef01f72c0306 -r 220ef22b0dcf sys/net80211/ieee80211_netbsd.c
--- a/sys/net80211/ieee80211_netbsd.c   Mon Dec 28 20:06:13 2020 +0100
+++ b/sys/net80211/ieee80211_netbsd.c   Tue Dec 29 16:33:08 2020 +0100
@@ -65,6 +65,7 @@
 
 #ifdef IEEE80211_DEBUG
 int ieee80211_debug = 0;
+static int ieee80211_debug_printf = 0;
 #endif
 
 int sysctl_ieee80211coms(SYSCTLFN_ARGS);
@@ -379,6 +380,12 @@ SYSCTL_SETUP(sysctl_net_wlan_setup, "sys
            "debug", SYSCTL_DESCR("control debugging printfs"),
            NULL, 0, &ieee80211_debug, 0, CTL_CREATE, CTL_EOL)) != 0)
                goto err;
+
+       if ((rc = sysctl_createv(&wlan_sysctl_clog, 0, &wlan_node, NULL,
+           CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_INT,
+           "debug_console", SYSCTL_DESCR("debug output goes to kernel console"),
+           NULL, 0, &ieee80211_debug_printf, 0, CTL_CREATE, CTL_EOL)) != 0)
+               goto err;
 #endif
 
        /* list of devices */
@@ -1350,10 +1357,20 @@ if_printf(struct ifnet *ifp, const char 
         va_list ap;
 
         snprintf(if_fmt, sizeof(if_fmt), "%s: %s", ifp->if_xname, fmt);
-        va_start(ap, fmt);
-        vlog(LOG_INFO, if_fmt, ap);
-        va_end(ap);
-        return (0);
+#ifdef IEEE80211_DEBUG
+       if (ieee80211_debug_printf) {
+               va_start(ap, fmt);
+               vprintf(if_fmt, ap);
+               va_end(ap);
+       } else {
+#else
+       {
+#endif
+               va_start(ap, fmt);
+               vlog(LOG_INFO, if_fmt, ap);
+               va_end(ap);
+       }
+        return 0;
 }
 
 /*



Home | Main Index | Thread Index | Old Index