]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
add netns command
authorJohannes Berg <johannes@sipsolutions.net>
Thu, 24 Sep 2009 18:18:47 +0000 (20:18 +0200)
committerJohannes Berg <johannes@sipsolutions.net>
Thu, 24 Sep 2009 18:18:47 +0000 (20:18 +0200)
iw phy#<idx> set netns <pid>

phy.c

diff --git a/phy.c b/phy.c
index b34f9db856d56a5d9b09b0e3daff6102d76308ab..8dd01aaab47085d0e8864b13531e60f4dc951b24 100644 (file)
--- a/phy.c
+++ b/phy.c
@@ -140,3 +140,27 @@ static int handle_rts(struct nl80211_state *state,
 COMMAND(set, rts, "<rts threshold|off>",
        NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_rts,
        "Set rts threshold.");
+
+static int handle_netns(struct nl80211_state *state,
+                       struct nl_cb *cb,
+                       struct nl_msg *msg,
+                       int argc, char **argv)
+{
+       char *end;
+
+       if (argc != 1)
+               return 1;
+
+       NLA_PUT_U32(msg, NL80211_ATTR_PID,
+                   strtoul(argv[0], &end, 10)); 
+
+       if (*end != '\0')
+               return 1;
+
+       return 0;
+ nla_put_failure:
+       return -ENOBUFS;
+}
+COMMAND(set, netns, "<pid>",
+       NL80211_CMD_SET_WIPHY_NETNS, 0, CIB_PHY, handle_netns,
+       "Put this wireless device into a different network namespace");