Oops, some additional patch for unmodified kernel detection
was missing.
--- shinoda
On 2012/09/03, at 5:07, LEO Airwarosu Yoichi Shinoda wrote:
> Hi List,
>
> This is the current patch for the iw-3.3 that is enhanced to
> display mpp_paths and known_gates paths for "mpath dump" and
> "mpath get".
>
> For this enhancement to work, mac80211 and cfg80211 should also
> be patched. This patch will be sent in a separate message.
>
> The motivation behind this patch is to provide a better tool
> that we can use when we actually operate production meshes,
> as well as providing a tool to peek into the various paths
> in the path lists, in the kernel.
>
> This is not a proposed patch, only intended to share some
> experiences with the such tool among member of the list.
>
> It also displays symbolic names rather than numeric values
> for MAC addresses and BSSIDs for all commands, if they are
> found in /etc/ethers. This enhancement does not require the
> mac80211 and cfg80211 patch.
---
diff --git a/mpath.c b/mpath.c
index 0195ce6..885e25e 100644
--- a/mpath.c
+++ b/mpath.c
@@ -31,11 +31,21 @@ static int print_mpath_handler(struct nl_msg *msg, void
*arg)
[NL80211_MPATH_INFO_EXPTIME] = { .type = NLA_U32 },
[NL80211_MPATH_INFO_DISCOVERY_TIMEOUT] = { .type = NLA_U32 },
[NL80211_MPATH_INFO_DISCOVERY_RETRIES] = { .type = NLA_U8 },
+ [NL80211_MPATH_INFO_FLAGS] = { .type = NLA_U8 },
+ };
+ static struct nla_policy mpath_policy2[NL80211_MPATH_INFO_MAX + 1] = {
+ [NL80211_MPATH_INFO_FRAME_QLEN] = { .type = NLA_U32 },
+ [NL80211_MPATH_INFO_SN] = { .type = NLA_U32 },
+ [NL80211_MPATH_INFO_METRIC] = { .type = NLA_U32 },
+ [NL80211_MPATH_INFO_EXPTIME] = { .type = NLA_U32 },
+ [NL80211_MPATH_INFO_DISCOVERY_TIMEOUT] = { .type = NLA_U32 },
+ [NL80211_MPATH_INFO_DISCOVERY_RETRIES] = { .type = NLA_U8 },
[NL80211_MPATH_INFO_FLAGS] = { .type = NLA_U32 },
};
uint32_t flags;
uint8_t *dstmac, *nxtmac;
char flagbuf[10], *flagp;
+ static bool flags_is_32bits = true;
nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
genlmsg_attrlen(gnlh, 0), NULL);
@@ -52,9 +62,18 @@ static int print_mpath_handler(struct nl_msg *msg, void *arg)
}
if (nla_parse_nested(pinfo, NL80211_MPATH_INFO_MAX,
tb[NL80211_ATTR_MPATH_INFO],
- mpath_policy)) {
- fprintf(stderr, "failed to parse nested attributes!\n");
- return NL_SKIP;
+ mpath_policy2)) {
+ if (nla_parse_nested(pinfo, NL80211_MPATH_INFO_MAX,
+ tb[NL80211_ATTR_MPATH_INFO],
+ mpath_policy)) {
+ fprintf(stderr, "failed to parse nested attributes!\n");
+ return NL_SKIP;
+ }
+ if (flags_is_32bits) {
+ if (getenv("IW_MPATH_FLAGS8") == NULL)
+ fprintf(stderr, "warning: non-extended flags
detected\n");
+ flags_is_32bits = false;
+ }
}
dstmac = nla_data(tb[NL80211_ATTR_MAC]);
@@ -82,7 +101,11 @@ static int print_mpath_handler(struct nl_msg *msg, void
*arg)
flagp = flagbuf;
if (pinfo[NL80211_MPATH_INFO_FLAGS]) {
- flags = nla_get_u32(pinfo[NL80211_MPATH_INFO_FLAGS]);
+ if (flags_is_32bits)
+ flags = nla_get_u32(pinfo[NL80211_MPATH_INFO_FLAGS]);
+ else
+ flags = nla_get_u8(pinfo[NL80211_MPATH_INFO_FLAGS]);
+
if (flags & NL80211_MPATH_FLAG_ACTIVE)
*flagp++ = 'A';
if (flags & NL80211_MPATH_FLAG_FIXED)
---
_______________________________________________
Devel mailing list
[email protected]
http://lists.open80211s.org/cgi-bin/mailman/listinfo/devel