Source-Changes-HG archive

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

[src-draft/trunk]: src/sys/net80211 ether_sprintf() is not reentrant.



details:   https://anonhg.NetBSD.org/src-all/rev/be12735754f1
branches:  trunk
changeset: 370999:be12735754f1
user:      Martin Husemann <martin%NetBSD.org@localhost>
date:      Thu Dec 10 18:22:42 2020 +0100

description:
ether_sprintf() is not reentrant.

diffstat:

 sys/net80211/ieee80211_node.c     |  17 +++++++++++++----
 sys/net80211/ieee80211_scan_sta.c |  14 +++++++++++---
 2 files changed, 24 insertions(+), 7 deletions(-)

diffs (71 lines):

diff -r 4b3236c0c309 -r be12735754f1 sys/net80211/ieee80211_node.c
--- a/sys/net80211/ieee80211_node.c     Thu Dec 10 18:07:58 2020 +0100
+++ b/sys/net80211/ieee80211_node.c     Thu Dec 10 18:22:42 2020 +0100
@@ -486,8 +486,12 @@
                ieee80211_free_node(obss);
        } else
                IEEE80211_ADDR_COPY(ni->ni_bssid, vap->iv_myaddr);
-       printf ("reset_bss: macaddr %s, bssid %s\n", 
-               ether_sprintf(ni->ni_macaddr), ether_sprintf(ni->ni_bssid));
+#ifdef IEEE80211_DEBUG
+       char temp[40];
+       strcpy(temp, ether_sprintf(ni->ni_macaddr));
+       printf ("reset_bss: macaddr %s, bssid %s\n",
+           temp, ether_sprintf(ni->ni_bssid));
+#endif
 }
 
 static int
@@ -1072,9 +1076,14 @@
        ieee80211_node_setuptxparms(ni);
        ieee80211_ratectl_node_init(ni);
 
+#ifdef IEEE80211_DEBUG
+       char temp[40];
+       strcpy(temp, ether_sprintf(ni->ni_macaddr));
        printf ("At end of ieee80211_sta_join, ni is 0x%lx\n", (long)ni);
-       printf ("   macaddr is %s,  bss is %s\n",
-               ether_sprintf(ni->ni_macaddr), ether_sprintf(ni->ni_bssid));
+       printf ("   macaddr is %s,  bss is %s\n", temp,
+               ether_sprintf(ni->ni_bssid));
+#endif
+
        return ieee80211_sta_join1(ieee80211_ref_node(ni));
 }
 
diff -r 4b3236c0c309 -r be12735754f1 sys/net80211/ieee80211_scan_sta.c
--- a/sys/net80211/ieee80211_scan_sta.c Thu Dec 10 18:07:58 2020 +0100
+++ b/sys/net80211/ieee80211_scan_sta.c Thu Dec 10 18:22:42 2020 +0100
@@ -1010,7 +1010,12 @@
 {
        int i;
 
-       printf ("match_ssid called:;; %s vs %s\n", ie, ssids[0].ssid);
+#ifdef IEEE80211_DEBUG
+       char temp[40];
+       strcpy(temp, ether_sprintf(ie));
+       printf ("match_ssid called: %s vs %s\n", temp,
+           ether_sprintf(ssids[0].ssid));
+#endif
                
        for (i = 0; i < nssid; i++) {
                if (match_id(ie, ssids[i].ssid, ssids[i].len))
@@ -1287,13 +1292,16 @@
        struct sta_entry *selbs;
        struct ieee80211_channel *chan;
 
+       KASSERT(ss != NULL && vap != NULL);
+#ifdef IEEE80211_DEBUG
        {       int i;
                printf ("sta_pick_bss called. vap des_ssid %s, scan ssids:", 
-                       vap->iv_des_ssid[0].ssid);
+                       ether_sprintf(vap->iv_des_ssid[0].ssid));
                for (i=0; i < ss->ss_nssid; i++)
-                       printf ("%s, ", ss->ss_ssid[i].ssid);
+                       printf ("%s, ", ether_sprintf(ss->ss_ssid[i].ssid));
                printf ("\n");
        }
+#endif
 
        KASSERTMSG(vap->iv_opmode == IEEE80211_M_STA,
                "wrong mode %u", vap->iv_opmode);



Home | Main Index | Thread Index | Old Index