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
1c0bec10
Unverified
Commit
1c0bec10
authored
Aug 09, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: type fixes lxc_netns_set_nsid()
The kernel expects a __s32 for NETNSA_NSID and a __u32 for NETNSA_FD. Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
6810e31d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
network.c
src/lxc/network.c
+10
-9
No files found.
src/lxc/network.c
View file @
1c0bec10
...
@@ -3164,7 +3164,7 @@ void lxc_delete_network(struct lxc_handler *handler)
...
@@ -3164,7 +3164,7 @@ void lxc_delete_network(struct lxc_handler *handler)
DEBUG
(
"Deleted network devices"
);
DEBUG
(
"Deleted network devices"
);
}
}
int
addattr
(
struct
nlmsghdr
*
n
,
int
maxlen
,
int
type
,
const
void
*
data
,
in
t
alen
)
int
addattr
(
struct
nlmsghdr
*
n
,
size_t
maxlen
,
int
type
,
const
void
*
data
,
size_
t
alen
)
{
{
int
len
=
RTA_LENGTH
(
alen
);
int
len
=
RTA_LENGTH
(
alen
);
struct
rtattr
*
rta
;
struct
rtattr
*
rta
;
...
@@ -3184,11 +3184,11 @@ int addattr(struct nlmsghdr *n, int maxlen, int type, const void *data, int alen
...
@@ -3184,11 +3184,11 @@ int addattr(struct nlmsghdr *n, int maxlen, int type, const void *data, int alen
/* Attributes of RTM_NEWNSID/RTM_GETNSID messages */
/* Attributes of RTM_NEWNSID/RTM_GETNSID messages */
enum
{
enum
{
LXC_NETNSA_NONE
,
__
LXC_NETNSA_NONE
,
#define LXC_NETNSA_NSID_NOT_ASSIGNED -1
#define
__
LXC_NETNSA_NSID_NOT_ASSIGNED -1
LXC_NETNSA_NSID
,
__
LXC_NETNSA_NSID
,
LXC_NETNSA_PID
,
__
LXC_NETNSA_PID
,
LXC_NETNSA_FD
,
__
LXC_NETNSA_FD
,
__LXC_NETNSA_MAX
,
__LXC_NETNSA_MAX
,
};
};
...
@@ -3202,7 +3202,8 @@ int lxc_netns_set_nsid(int fd)
...
@@ -3202,7 +3202,8 @@ int lxc_netns_set_nsid(int fd)
struct
nlmsghdr
*
l_hdr
;
struct
nlmsghdr
*
l_hdr
;
struct
rtgenmsg
*
l_msg
;
struct
rtgenmsg
*
l_msg
;
struct
sockaddr_nl
l_addr
;
struct
sockaddr_nl
l_addr
;
int
nsid
=
-
1
;
__s32
ns_id
=
-
1
;
__u32
netns_fd
=
fd
;
ret
=
netlink_open
(
&
nlh
,
NETLINK_ROUTE
);
ret
=
netlink_open
(
&
nlh
,
NETLINK_ROUTE
);
if
(
ret
<
0
)
if
(
ret
<
0
)
...
@@ -3219,8 +3220,8 @@ int lxc_netns_set_nsid(int fd)
...
@@ -3219,8 +3220,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
,
LXC_NETNSA_FD
,
&
fd
,
sizeof
(
__u32
));
addattr
(
l_hdr
,
1024
,
__LXC_NETNSA_FD
,
&
netns_fd
,
sizeof
(
netns_fd
));
addattr
(
l_hdr
,
1024
,
LXC_NETNSA_NSID
,
&
nsid
,
sizeof
(
__u32
));
addattr
(
l_hdr
,
1024
,
__LXC_NETNSA_NSID
,
&
ns_id
,
sizeof
(
ns_id
));
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
;
...
...
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