netns: vendor NETNSA_*

parent ac9bd624
...@@ -183,4 +183,8 @@ extern int __build_bug_on_failed; ...@@ -183,4 +183,8 @@ extern int __build_bug_on_failed;
#define IFLA_IF_NETNSID 46 #define IFLA_IF_NETNSID 46
#endif #endif
#ifndef RTM_NEWNSID
#define RTM_NEWNSID 88
#endif
#endif /* __LXC_MACRO_H */ #endif /* __LXC_MACRO_H */
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <linux/net_namespace.h>
#include <linux/netlink.h> #include <linux/netlink.h>
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include <linux/sockios.h> #include <linux/sockios.h>
...@@ -3183,6 +3182,16 @@ int addattr(struct nlmsghdr *n, int maxlen, int type, const void *data, int alen ...@@ -3183,6 +3182,16 @@ int addattr(struct nlmsghdr *n, int maxlen, int type, const void *data, int alen
return 0; 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) int lxc_netns_set_nsid(int fd)
{ {
ssize_t ret; ssize_t ret;
...@@ -3210,8 +3219,8 @@ int lxc_netns_set_nsid(int fd) ...@@ -3210,8 +3219,8 @@ int lxc_netns_set_nsid(int fd)
l_hdr->nlmsg_seq = RTM_NEWNSID; l_hdr->nlmsg_seq = RTM_NEWNSID;
l_msg->rtgen_family = AF_UNSPEC; l_msg->rtgen_family = AF_UNSPEC;
addattr(l_hdr, 1024, NETNSA_FD, &fd, sizeof(__u32)); addattr(l_hdr, 1024, LXC_NETNSA_FD, &fd, sizeof(__u32));
addattr(l_hdr, 1024, NETNSA_NSID, &nsid, sizeof(__u32)); addattr(l_hdr, 1024, LXC_NETNSA_NSID, &nsid, sizeof(__u32));
memset(&l_addr, 0, sizeof(l_addr)); memset(&l_addr, 0, sizeof(l_addr));
l_addr.nl_family = AF_NETLINK; l_addr.nl_family = AF_NETLINK;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment