This adds support for setting the IFLA_NET_NS_PID attribute
on links allowing them to be moved between network namespaces.

Signed-off-by: Eric W. Biederman <[EMAIL PROTECTED]>
---
 include/linux/if_link.h |    1 +
 ip/iplink.c             |    9 +++++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 23b3a8e..c948395 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -78,6 +78,7 @@ enum
        IFLA_LINKMODE,
        IFLA_LINKINFO,
 #define IFLA_LINKINFO IFLA_LINKINFO
+       IFLA_NET_NS_PID,
        __IFLA_MAX
 };
 
diff --git a/ip/iplink.c b/ip/iplink.c
index 541f3d6..624c784 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -158,6 +158,7 @@ int iplink_parse(int argc, char **argv, struct iplink_req 
*req,
        char abuf[32];
        int qlen = -1;
        int mtu = -1;
+       pid_t netns_pid = -1;
 
        ret = argc;
 
@@ -255,6 +256,14 @@ int iplink_parse(int argc, char **argv, struct iplink_req 
*req,
                        } else
                                return on_off("dynamic");
 #endif
+               } else if (matches(*argv, "netnspid") == 0) {
+                       NEXT_ARG();
+                       if (netns_pid != -1)
+                               duparg("netnspid", *argv);
+                       if (get_integer(&netns_pid, *argv, 0))
+                               invarg("Invalid \"netnspid\" value\n", *argv);
+                       addattr_l(&req->n, sizeof(*req), IFLA_NET_NS_PID,
+                               &netns_pid, sizeof(netns_pid));
                } else if (matches(*argv, "type") == 0) {
                        NEXT_ARG();
                        *type = *argv;
-- 
1.5.3.rc6.17.g1911

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to