Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
6810e31d
Unverified
Commit
6810e31d
authored
Aug 08, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
netns: vendor NETNSA_*
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
ac9bd624
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
macro.h
src/lxc/macro.h
+4
-0
network.c
src/lxc/network.c
+12
-3
No files found.
src/lxc/macro.h
View file @
6810e31d
...
...
@@ -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 */
src/lxc/network.c
View file @
6810e31d
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment