]> git.proxmox.com Git - mirror_lxc.git/commitdiff
netns: vendor NETNSA_*
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 8 Aug 2018 11:51:40 +0000 (13:51 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 8 Aug 2018 11:57:40 +0000 (13:57 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/macro.h
src/lxc/network.c

index 236742c80a48d24a79956309b4df2db08f12a1cc..83c40cef033216331d7eedc26a1c844b7942114a 100644 (file)
@@ -183,4 +183,8 @@ extern int __build_bug_on_failed;
 #define IFLA_IF_NETNSID 46
 #endif
 
+#ifndef RTM_NEWNSID
+#define RTM_NEWNSID 88
+#endif
+
 #endif /* __LXC_MACRO_H */
index 31b376c2ddcc57a0225b581aa975ed663bc198e8..277133513091d9ee1a4f5d30a10b19bc85baaa97 100644 (file)
@@ -31,7 +31,6 @@
 #include <time.h>
 #include <unistd.h>
 #include <arpa/inet.h>
-#include <linux/net_namespace.h>
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
 #include <linux/sockios.h>
@@ -3183,6 +3182,16 @@ int addattr(struct nlmsghdr *n, int maxlen, int type, const void *data, int alen
        return 0;
 }
 
+/* Attributes of RTM_NEWNSID/RTM_GETNSID messages */
+enum {
+       LXC_NETNSA_NONE,
+#define LXC_NETNSA_NSID_NOT_ASSIGNED -1
+       LXC_NETNSA_NSID,
+       LXC_NETNSA_PID,
+       LXC_NETNSA_FD,
+       __LXC_NETNSA_MAX,
+};
+
 int lxc_netns_set_nsid(int fd)
 {
        ssize_t ret;
@@ -3210,8 +3219,8 @@ int lxc_netns_set_nsid(int fd)
        l_hdr->nlmsg_seq = RTM_NEWNSID;
        l_msg->rtgen_family = AF_UNSPEC;
 
-       addattr(l_hdr, 1024, NETNSA_FD, &fd, sizeof(__u32));
-       addattr(l_hdr, 1024, NETNSA_NSID, &nsid, sizeof(__u32));
+       addattr(l_hdr, 1024, LXC_NETNSA_FD, &fd, sizeof(__u32));
+       addattr(l_hdr, 1024, LXC_NETNSA_NSID, &nsid, sizeof(__u32));
 
        memset(&l_addr, 0, sizeof(l_addr));
        l_addr.nl_family = AF_NETLINK;