Author: adrian
Date: Sat Jan 21 00:38:18 2012
New Revision: 230408
URL: http://svn.freebsd.org/changeset/base/230408

Log:
  Change the hwmp debugging to use %6D rather than ether_sprintf().
  
  This allows for multiple MAC addresses to be printed on the same
  debugging line.  ether_sprintf() uses a static char buffer and
  thus isn't very useful here.
  
  Submitted by: Monthadar Al Jaberi <montha...@gmail.com>

Modified:
  head/sys/net80211/ieee80211_hwmp.c

Modified: head/sys/net80211/ieee80211_hwmp.c
==============================================================================
--- head/sys/net80211/ieee80211_hwmp.c  Sat Jan 21 00:06:21 2012        
(r230407)
+++ head/sys/net80211/ieee80211_hwmp.c  Sat Jan 21 00:38:18 2012        
(r230408)
@@ -33,15 +33,15 @@ __FBSDID("$FreeBSD$");
 
 /*
  * IEEE 802.11s Hybrid Wireless Mesh Protocol, HWMP.
- * 
+ *
  * Based on March 2009, D3.0 802.11s draft spec.
  */
 #include "opt_inet.h"
 #include "opt_wlan.h"
 
 #include <sys/param.h>
-#include <sys/systm.h> 
-#include <sys/mbuf.h>   
+#include <sys/systm.h>
+#include <sys/mbuf.h>
 #include <sys/malloc.h>
 #include <sys/kernel.h>
 
@@ -692,7 +692,7 @@ hwmp_recv_preq(struct ieee80211vap *vap,
                return;
 
        IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
-           "received PREQ, source %s", ether_sprintf(preq->preq_origaddr));
+           "received PREQ, source %6D", preq->preq_origaddr, ":");
 
        /*
         * Acceptance criteria: if the PREQ is not for us and
@@ -718,8 +718,8 @@ hwmp_recv_preq(struct ieee80211vap *vap,
        if (HWMP_SEQ_LEQ(preq->preq_id, hrorig->hr_preqid) &&
            HWMP_SEQ_LEQ(preq->preq_origseq, hrorig->hr_seq)) {
                IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
-                   "discard PREQ from %s, old seq no %u <= %u",
-                   ether_sprintf(preq->preq_origaddr),
+                   "discard PREQ from %6D, old seq no %u <= %u",
+                   preq->preq_origaddr, ":",
                    preq->preq_origseq, hrorig->hr_seq);
                return;
        }
@@ -731,7 +731,7 @@ hwmp_recv_preq(struct ieee80211vap *vap,
         */
        if (IEEE80211_ADDR_EQ(vap->iv_myaddr, PREQ_TADDR(0))) {
                IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
-                   "reply to %s", ether_sprintf(preq->preq_origaddr));
+                   "reply to %6D", preq->preq_origaddr, ":");
                /*
                 * Build and send a PREP frame.
                 */
@@ -771,14 +771,14 @@ hwmp_recv_preq(struct ieee80211vap *vap,
                        rt = ieee80211_mesh_rt_add(vap, rootmac);
                        if (rt == NULL) {
                                IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
-                                   "unable to add root mesh path to %s",
-                                   ether_sprintf(rootmac));
+                                   "unable to add root mesh path to %6D",
+                                   rootmac, ":");
                                vap->iv_stats.is_mesh_rtaddfailed++;
                                return;
                        }
                }
                IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
-                   "root mesh station @ %s", ether_sprintf(rootmac));
+                   "root mesh station @ %6D", rootmac, ":");
 
                /*
                 * Reply with a PREP if we don't have a path to the root
@@ -819,8 +819,8 @@ hwmp_recv_preq(struct ieee80211vap *vap,
                        if (preq->preq_ttl > 1 &&
                            preq->preq_hopcount < hs->hs_maxhops) {
                                IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
-                                   "forward PREQ from %s",
-                                   ether_sprintf(preq->preq_origaddr));
+                                   "forward PREQ from %6D",
+                                   preq->preq_origaddr, ":");
                                /*
                                 * Propagate the original PREQ.
                                 */
@@ -847,8 +847,8 @@ hwmp_recv_preq(struct ieee80211vap *vap,
                                struct ieee80211_meshprep_ie prep;
 
                                IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
-                                   "intermediate reply for PREQ from %s",
-                                   ether_sprintf(preq->preq_origaddr));
+                                   "intermediate reply for PREQ from %6D",
+                                   preq->preq_origaddr, ":");
                                prep.prep_flags = 0;
                                prep.prep_hopcount = rt->rt_nhops + 1;
                                prep.prep_ttl = ms->ms_ttl;
@@ -873,9 +873,10 @@ hwmp_recv_preq(struct ieee80211vap *vap,
                        if (rt == NULL) {
                                rt = ieee80211_mesh_rt_add(vap, PREQ_TADDR(0));
                                if (rt == NULL) {
-                                       IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP,
-                                           ni, "unable to add PREQ path to %s",
-                                           ether_sprintf(PREQ_TADDR(0)));
+                                       IEEE80211_NOTE(vap,
+                                           IEEE80211_MSG_HWMP, ni,
+                                           "unable to add PREQ path to %6D",
+                                           PREQ_TADDR(0), ":");
                                        vap->iv_stats.is_mesh_rtaddfailed++;
                                        return;
                                }
@@ -888,8 +889,8 @@ hwmp_recv_preq(struct ieee80211vap *vap,
                        hrorig->hr_preqid = preq->preq_id;
 
                        IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
-                           "forward PREQ from %s",
-                           ether_sprintf(preq->preq_origaddr));
+                           "forward PREQ from %6D",
+                           preq->preq_origaddr, ":");
                        ppreq.preq_hopcount += 1;
                        ppreq.preq_ttl -= 1;
                        ppreq.preq_metric += ms->ms_pmetric->mpm_metric(ni);
@@ -956,7 +957,7 @@ hwmp_recv_prep(struct ieee80211vap *vap,
                return;
 
        IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
-           "received PREP from %s", ether_sprintf(prep->prep_targetaddr));
+           "received PREP from %6D", prep->prep_targetaddr, ":");
 
        rt = ieee80211_mesh_rt_find(vap, prep->prep_targetaddr);
        if (rt == NULL) {
@@ -967,8 +968,8 @@ hwmp_recv_prep(struct ieee80211vap *vap,
                        rt = ieee80211_mesh_rt_add(vap, prep->prep_targetaddr);
                        if (rt == NULL) {
                                IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP,
-                                   ni, "unable to add PREP path to %s",
-                                   ether_sprintf(prep->prep_targetaddr));
+                                   ni, "unable to add PREP path to %6D",
+                                   prep->prep_targetaddr, ":");
                                vap->iv_stats.is_mesh_rtaddfailed++;
                                return;
                        }
@@ -991,8 +992,8 @@ hwmp_recv_prep(struct ieee80211vap *vap,
        hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route);
        if (HWMP_SEQ_LEQ(prep->prep_targetseq, hr->hr_seq)) {
                IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
-                   "discard PREP from %s, old seq no %u <= %u",
-                   ether_sprintf(prep->prep_targetaddr),
+                   "discard PREP from %6D, old seq no %u <= %u",
+                   prep->prep_targetaddr, ":",
                    prep->prep_targetseq, hr->hr_seq);
                return;
        }
@@ -1005,8 +1006,8 @@ hwmp_recv_prep(struct ieee80211vap *vap,
                struct ieee80211_meshprep_ie pprep; /* propagated PREP */
 
                IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
-                   "propagate PREP from %s",
-                   ether_sprintf(prep->prep_targetaddr));
+                   "propagate PREP from %6D",
+                   prep->prep_targetaddr, ":");
 
                memcpy(&pprep, prep, sizeof(pprep));
                pprep.prep_hopcount += 1;
@@ -1019,8 +1020,8 @@ hwmp_recv_prep(struct ieee80211vap *vap,
        if (rt->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY) {
                /* NB: never clobber a proxy entry */;
                IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
-                   "discard PREP for %s, route is marked PROXY",
-                   ether_sprintf(prep->prep_targetaddr));
+                   "discard PREP for %6D, route is marked PROXY",
+                   prep->prep_targetaddr, ":");
                vap->iv_stats.is_hwmp_proxy++;
        } else if (prep->prep_origseq == hr->hr_origseq) {
                /*
@@ -1032,10 +1033,10 @@ hwmp_recv_prep(struct ieee80211vap *vap,
                    (prep->prep_hopcount < rt->rt_nhops ||
                     prep->prep_metric < rt->rt_metric)) {
                        IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
-                           "%s path to %s, hopcount %d:%d metric %d:%d",
+                           "%s path to %6D, hopcount %d:%d metric %d:%d",
                            rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID ?
                                "prefer" : "update",
-                           ether_sprintf(prep->prep_origaddr),
+                           prep->prep_origaddr, ":",
                            rt->rt_nhops, prep->prep_hopcount,
                            rt->rt_metric, prep->prep_metric);
                        IEEE80211_ADDR_COPY(rt->rt_nexthop, wh->i_addr2);
@@ -1045,8 +1046,8 @@ hwmp_recv_prep(struct ieee80211vap *vap,
                        rt->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID;
                } else {
                        IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
-                           "ignore PREP for %s, hopcount %d:%d metric %d:%d",
-                           ether_sprintf(prep->prep_targetaddr),
+                           "ignore PREP for %6D, hopcount %d:%d metric %d:%d",
+                           prep->prep_targetaddr, ":",
                            rt->rt_nhops, prep->prep_hopcount,
                            rt->rt_metric, prep->prep_metric);
                }
@@ -1179,7 +1180,7 @@ hwmp_recv_perr(struct ieee80211vap *vap,
         */
        if (forward && perr->perr_ttl > 1) {
                IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
-                   "propagate PERR from %s", ether_sprintf(wh->i_addr2));
+                   "propagate PERR from %6D", wh->i_addr2, ":");
                memcpy(&pperr, perr, sizeof(*perr));
                pperr.perr_ttl--;
                hwmp_send_perr(vap->iv_bss, vap->iv_myaddr, broadcastaddr,
@@ -1306,8 +1307,8 @@ hwmp_discover(struct ieee80211vap *vap,
                        rt = ieee80211_mesh_rt_add(vap, dest);
                        if (rt == NULL) {
                                IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP,
-                                   ni, "unable to add discovery path to %s",
-                                   ether_sprintf(dest));
+                                   ni, "unable to add discovery path to %6D",
+                                   dest, ":");
                                vap->iv_stats.is_mesh_rtaddfailed++;
                                goto done;
                        }
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to