]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: add beacon interval and DTIM period parameters to mesh join
authorMarco Porsch <marco@cozybit.com>
Fri, 18 Jan 2013 12:05:30 +0000 (13:05 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 29 Jan 2013 11:54:44 +0000 (12:54 +0100)
Set the beacon interval and DTIM period with the mesh join
command:
iw <dev> mesh join <meshid> beacon-interval <time in TUs>
dtim-period <value>

Signed-off-by: Marco Porsch <marco@cozybit.com>
mesh.c

diff --git a/mesh.c b/mesh.c
index 4fdad6a09a76991c73005be575bde5d0a9a9d4a5..958c2c077a8b503cc3bf5730bb1b2af7415e43b4 100644 (file)
--- a/mesh.c
+++ b/mesh.c
@@ -383,6 +383,7 @@ static int join_mesh(struct nl80211_state *state, struct nl_cb *cb,
 {
        struct nlattr *container;
        float rate;
+       int bintval, dtim_period;
        char *end;
 
        if (argc < 1)
@@ -405,6 +406,32 @@ static int join_mesh(struct nl80211_state *state, struct nl_cb *cb,
                argc--;
        }
 
+       if (argc > 1 && strcmp(argv[0], "beacon-interval") == 0) {
+               argc--;
+               argv++;
+
+               bintval = strtoul(argv[0], &end, 10);
+               if (*end != '\0')
+                       return 1;
+
+               NLA_PUT_U32(msg, NL80211_ATTR_BEACON_INTERVAL, bintval);
+               argv++;
+               argc--;
+       }
+
+       if (argc > 1 && strcmp(argv[0], "dtim-period") == 0) {
+               argc--;
+               argv++;
+
+               dtim_period = strtoul(argv[0], &end, 10);
+               if (*end != '\0')
+                       return 1;
+
+               NLA_PUT_U32(msg, NL80211_ATTR_DTIM_PERIOD, dtim_period);
+               argv++;
+               argc--;
+       }
+
        container = nla_nest_start(msg, NL80211_ATTR_MESH_SETUP);
        if (!container)
                return -ENOBUFS;
@@ -431,8 +458,9 @@ static int join_mesh(struct nl80211_state *state, struct nl_cb *cb,
  nla_put_failure:
        return -ENOBUFS;
 }
-COMMAND(mesh, join, "<mesh ID> [mcast-rate <rate in Mbps>] [vendor_sync on|off]"
-       " [<param>=<value>]*",
+COMMAND(mesh, join, "<mesh ID> [mcast-rate <rate in Mbps>]"
+       " [beacon-interval <time in TUs>] [dtim-period <value>]"
+       " [vendor_sync on|off] [<param>=<value>]*",
        NL80211_CMD_JOIN_MESH, 0, CIB_NETDEV, join_mesh,
        "Join a mesh with the given mesh ID with mcast-rate and mesh parameters.");