From 3d1e870417f99fadd5c7af4ce0e31e2d3b6aa818 Mon Sep 17 00:00:00 2001 From: Luis Carlos Cobo Date: Tue, 1 Apr 2008 12:03:41 -0700 Subject: Add support for mesh interfaces On interface creation, if interface type is mesh point (mp or mesh), a mesh_id can be specified. Mesh paths and stations (including non-mesh stations) can be dumped and manipulated. You can find some usage examples at: http://o11s.org/trac/wiki/HOWTO-0.2.1#Testing http://o11s.org/trac/wiki/HOWTO-0.2.1#AdvancedTinkering --- interface.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'interface.c') diff --git a/interface.c b/interface.c index efc2d93..3ef9b18 100644 --- a/interface.c +++ b/interface.c @@ -45,6 +45,10 @@ static int get_if_type(int *argc, char ***argv, enum nl80211_iftype *type) } else if (strcmp(tpstr, "station") == 0) { *type = NL80211_IFTYPE_STATION; return 1; + } else if (strcmp(tpstr, "mp") == 0 || + strcmp(tpstr, "mesh") == 0) { + *type = NL80211_IFTYPE_MESH_POINT; + return 1; } @@ -56,6 +60,7 @@ static int handle_interface_add(struct nl80211_state *state, char *phy, char *dev, int argc, char **argv) { char *name; + char *mesh_id = NULL; enum nl80211_iftype type; int tpset, err; struct nl_msg *msg; @@ -75,6 +80,23 @@ static int handle_interface_add(struct nl80211_state *state, if (tpset <= 0) return -1; + if (argc) { + if (strcmp(argv[0], "mesh_id") != 0) { + fprintf(stderr, "option %s not supported\n", argv[0]); + return -1; + } + argc--; + argv++; + + if (!argc) { + fprintf(stderr, "not enough arguments\n"); + return -1; + } + mesh_id = argv[0]; + argc--; + argv++; + } + if (argc) { fprintf(stderr, "too many arguments\n"); return -1; @@ -95,6 +117,8 @@ static int handle_interface_add(struct nl80211_state *state, NLA_PUT_STRING(msg, NL80211_ATTR_IFNAME, name); if (tpset) NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, type); + if (mesh_id) + NLA_PUT(msg, NL80211_ATTR_MESH_ID, strlen(mesh_id), mesh_id); if ((err = nl_send_auto_complete(state->nl_handle, msg)) < 0 || (err = nl_wait_for_ack(state->nl_handle)) < 0) { -- cgit v1.2.3