Date: Mon, 16 Jan 2012 20:46:46 +0100 From: Monthadar Al Jaberi <monthadar@gmail.com> To: Bernhard Schmidt <bschmidt@freebsd.org> Cc: freebsd-wireless@freebsd.org Subject: Re: 11s mesh path setup problem Message-ID: <CA%2BsBSoJ8PBPMnfReiCHEcL_J23rhmCYJrxFPkFrgLpJ-3i_s-g@mail.gmail.com> In-Reply-To: <CA%2BsBSo%2BuYa-6w8VFBMTyhWFHCNezMH5HBHJONCRvWRy6QuaCbQ@mail.gmail.com> References: <CA%2BsBSoJWXD5S-zvxHR_=iwh26G0bd00trR=E-jCUBD03uMrU%2BQ@mail.gmail.com> <CAJ-VmomX2NK6p%2BckB6Gc40sz0PTx7cf7NznVLH1tTPvnhmHH6A@mail.gmail.com> <201201112003.44891.bschmidt@freebsd.org> <CA%2BsBSo%2BuYa-6w8VFBMTyhWFHCNezMH5HBHJONCRvWRy6QuaCbQ@mail.gmail.com>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
On Mon, Jan 16, 2012 at 9:39 AM, Monthadar Al Jaberi
<monthadar@gmail.com> wrote:
> On Wed, Jan 11, 2012 at 8:03 PM, Bernhard Schmidt <bschmidt@freebsd.org> wrote:
>> On Wednesday 11 January 2012 18:23:29 Adrian Chadd wrote:
>>> Hi!
>>>
>>> I've just done a bit of a code review. Here are my comments:
>
> sorry for late answer here is a a better formated patch.
>
>>>
>>> * ether_sprintf() can't be implemented the way you've implemented it -
>>> it just won't work at all in a multithreaded, concurrent environment.
>>> We'll have to find an alternative way.
>>>
>>> Maybe something like:
>>>
>>> char *
>>> ether_sprintf2(const u_char *ap, char *buf, int len)
>>> {
>>> .. do things to buf, rather than the static buf.
>>> }
>>>
>>> Then maybe this'd work:
>>>
>>> char a[32], b[32];
>>> IEEE80211_NOTE(..., ether_sprintf2(addr1, a, 32), ether_sprintf2(addr2, a, 32));
>>>
>>> does that make sense?
>>
>> Isn't there an example in net80211 with %D?
>> printf("%6D %6D", addr1, ":", addr2, ":");
Ok here is a patch just for fixing ieee80211_hwmp IEEE80211_NOTE
function calls before my patch.
does it look okej?
>>
>> The saner alternative is to call printf() multiple times, see ieee80211_dump_pkt() as an example.
>
> But that means we have to modify for example ieee80211_note_mac function?
>
>>
>> --
>> Bernhard
>
>
>
> --
> Monthadar Al Jaberi
--
Monthadar Al Jaberi
[-- Attachment #2 --]
diff --git a/sys/net80211/ieee80211_hwmp.c b/sys/net80211/ieee80211_hwmp.c
index 93a9e55..70f7fa6 100644
--- a/sys/net80211/ieee80211_hwmp.c
+++ b/sys/net80211/ieee80211_hwmp.c
@@ -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, struct ieee80211_node *ni,
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, struct ieee80211_node *ni,
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, struct ieee80211_node *ni,
*/
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, struct ieee80211_node *ni,
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, struct ieee80211_node *ni,
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_node *ni,
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, struct ieee80211_node *ni,
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, struct ieee80211_node *ni,
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, struct ieee80211_node *ni,
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, struct ieee80211_node *ni,
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, struct ieee80211_node *ni,
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_node *ni,
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, struct ieee80211_node *ni,
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, struct ieee80211_node *ni,
(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, struct ieee80211_node *ni,
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, struct ieee80211_node *ni,
*/
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;
}
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2BsBSoJ8PBPMnfReiCHEcL_J23rhmCYJrxFPkFrgLpJ-3i_s-g>
