#include "nl80211.h"
#include "iw.h"
+SECTION(mpath);
+
enum plink_state {
LISTEN,
OPN_SNT,
BLOCKED
};
-enum plink_actions {
- PLINK_ACTION_UNDEFINED,
- PLINK_ACTION_OPEN,
- PLINK_ACTION_BLOCK,
-};
-
static int print_mpath_handler(struct nl_msg *msg, void *arg)
{
char dst[20], next_hop[20], dev[20];
static struct nla_policy mpath_policy[NL80211_MPATH_INFO_MAX + 1] = {
[NL80211_MPATH_INFO_FRAME_QLEN] = { .type = NLA_U32 },
- [NL80211_MPATH_INFO_DSN] = { .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 },
*/
if (!tb[NL80211_ATTR_MPATH_INFO]) {
- fprintf(stderr, "mpath info missing!");
+ fprintf(stderr, "mpath info missing!\n");
return NL_SKIP;
}
if (nla_parse_nested(pinfo, NL80211_MPATH_INFO_MAX,
tb[NL80211_ATTR_MPATH_INFO],
mpath_policy)) {
- fprintf(stderr, "failed to parse nested attributes!");
+ fprintf(stderr, "failed to parse nested attributes!\n");
return NL_SKIP;
}
mac_addr_n2a(next_hop, nla_data(tb[NL80211_ATTR_MPATH_NEXT_HOP]));
if_indextoname(nla_get_u32(tb[NL80211_ATTR_IFINDEX]), dev);
printf("%s %s %s", dst, next_hop, dev);
- if (pinfo[NL80211_MPATH_INFO_DSN])
+ if (pinfo[NL80211_MPATH_INFO_SN])
printf("\t%u",
- nla_get_u32(pinfo[NL80211_MPATH_INFO_DSN]));
+ nla_get_u32(pinfo[NL80211_MPATH_INFO_SN]));
if (pinfo[NL80211_MPATH_INFO_METRIC])
printf("\t%u",
nla_get_u32(pinfo[NL80211_MPATH_INFO_METRIC]));
static int handle_mpath_get(struct nl80211_state *state,
struct nl_cb *cb,
struct nl_msg *msg,
- int argc, char **argv)
+ int argc, char **argv,
+ enum id_input id)
{
unsigned char dst[ETH_ALEN];
return -ENOBUFS;
}
COMMAND(mpath, get, "<MAC address>",
- NL80211_CMD_GET_MPATH, 0, CIB_NETDEV, handle_mpath_get, NULL);
+ NL80211_CMD_GET_MPATH, 0, CIB_NETDEV, handle_mpath_get,
+ "Get information on mesh path to the given node.");
COMMAND(mpath, del, "<MAC address>",
- NL80211_CMD_DEL_MPATH, 0, CIB_NETDEV, handle_mpath_get, NULL);
+ NL80211_CMD_DEL_MPATH, 0, CIB_NETDEV, handle_mpath_get,
+ "Remove the mesh path to the given node.");
static int handle_mpath_set(struct nl80211_state *state,
struct nl_cb *cb,
struct nl_msg *msg,
- int argc, char **argv)
+ int argc, char **argv,
+ enum id_input id)
{
unsigned char dst[ETH_ALEN];
unsigned char next_hop[ETH_ALEN];
return -ENOBUFS;
}
COMMAND(mpath, new, "<destination MAC address> next_hop <next hop MAC address>",
- NL80211_CMD_NEW_MPATH, 0, CIB_NETDEV, handle_mpath_set, NULL);
+ NL80211_CMD_NEW_MPATH, 0, CIB_NETDEV, handle_mpath_set,
+ "Create a new mesh path (instead of relying on automatic discovery).");
COMMAND(mpath, set, "<destination MAC address> next_hop <next hop MAC address>",
- NL80211_CMD_SET_MPATH, 0, CIB_NETDEV, handle_mpath_set, NULL);
+ NL80211_CMD_SET_MPATH, 0, CIB_NETDEV, handle_mpath_set,
+ "Set an existing mesh path's next hop.");
static int handle_mpath_dump(struct nl80211_state *state,
struct nl_cb *cb,
struct nl_msg *msg,
- int argc, char **argv)
+ int argc, char **argv,
+ enum id_input id)
{
+ printf("DEST ADDR NEXT HOP IFACE\tSN\tMETRIC\tQLEN\t"
+ "EXPTIME\t\tDTIM\tDRET\tFLAGS\n");
nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_mpath_handler, NULL);
return 0;
}
COMMAND(mpath, dump, NULL,
- NL80211_CMD_GET_MPATH, NLM_F_DUMP, CIB_NETDEV, handle_mpath_dump, NULL);
+ NL80211_CMD_GET_MPATH, NLM_F_DUMP, CIB_NETDEV, handle_mpath_dump,
+ "List known mesh paths.");