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
535e8859
Unverified
Commit
535e8859
authored
Sep 01, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: non-functional changes
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
de4855a8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
network.c
src/lxc/network.c
+10
-7
network.h
src/lxc/network.h
+1
-1
No files found.
src/lxc/network.c
View file @
535e8859
...
@@ -1914,6 +1914,9 @@ char *lxc_mkifname(const char *template)
...
@@ -1914,6 +1914,9 @@ char *lxc_mkifname(const char *template)
FILE
*
urandom
;
FILE
*
urandom
;
struct
ifaddrs
*
ifa
,
*
ifaddr
;
struct
ifaddrs
*
ifa
,
*
ifaddr
;
if
(
strlen
(
template
)
>=
IFNAMSIZ
)
return
NULL
;
/* Get all the network interfaces. */
/* Get all the network interfaces. */
getifaddrs
(
&
ifaddr
);
getifaddrs
(
&
ifaddr
);
...
@@ -2389,7 +2392,7 @@ int lxc_create_network_priv(struct lxc_handler *handler)
...
@@ -2389,7 +2392,7 @@ int lxc_create_network_priv(struct lxc_handler *handler)
int
lxc_network_move_created_netdev_priv
(
const
char
*
lxcpath
,
char
*
lxcname
,
int
lxc_network_move_created_netdev_priv
(
const
char
*
lxcpath
,
char
*
lxcname
,
struct
lxc_list
*
network
,
pid_t
pid
)
struct
lxc_list
*
network
,
pid_t
pid
)
{
{
int
err
;
int
ret
;
char
ifname
[
IFNAMSIZ
];
char
ifname
[
IFNAMSIZ
];
struct
lxc_list
*
iterator
;
struct
lxc_list
*
iterator
;
...
@@ -2409,16 +2412,17 @@ int lxc_network_move_created_netdev_priv(const char *lxcpath, char *lxcname,
...
@@ -2409,16 +2412,17 @@ int lxc_network_move_created_netdev_priv(const char *lxcpath, char *lxcname,
return
-
1
;
return
-
1
;
}
}
err
=
lxc_netdev_move_by_name
(
ifname
,
pid
,
NULL
);
ret
=
lxc_netdev_move_by_name
(
ifname
,
pid
,
NULL
);
if
(
err
)
{
if
(
ret
)
{
ERROR
(
"Failed to move network device
\"
%s
\"
to "
ERROR
(
"Failed to move network device
\"
%s
\"
to "
"network namespace %d: %s"
,
ifname
,
pid
,
"network namespace %d: %s"
,
ifname
,
pid
,
strerror
(
-
err
));
strerror
(
-
ret
));
return
-
1
;
return
-
1
;
}
}
DEBUG
(
"Moved network device
\"
%s
\"
/
\"
%s
\"
to network namespace "
DEBUG
(
"Moved network device
\"
%s
\"
/
\"
%s
\"
to network namespace "
"of %d:"
,
ifname
,
netdev
->
name
[
0
]
!=
'\0'
?
netdev
->
name
:
"(null)"
,
"of %d:"
,
ifname
,
netdev
->
name
[
0
]
!=
'\0'
?
netdev
->
name
:
"(null)"
,
pid
);
pid
);
}
}
...
@@ -2733,8 +2737,7 @@ static int lxc_setup_netdev_in_child_namespaces(struct lxc_netdev *netdev)
...
@@ -2733,8 +2737,7 @@ static int lxc_setup_netdev_in_child_namespaces(struct lxc_netdev *netdev)
if
(
netdev
->
type
!=
LXC_NET_VETH
)
{
if
(
netdev
->
type
!=
LXC_NET_VETH
)
{
net_type_name
=
lxc_net_type_to_str
(
netdev
->
type
);
net_type_name
=
lxc_net_type_to_str
(
netdev
->
type
);
ERROR
(
"%s networks are not supported for containers "
ERROR
(
"%s networks are not supported for containers "
"not setup up by privileged users"
,
"not setup up by privileged users"
,
net_type_name
);
net_type_name
);
return
-
1
;
return
-
1
;
}
}
...
...
src/lxc/network.h
View file @
535e8859
...
@@ -175,7 +175,7 @@ struct saved_nic {
...
@@ -175,7 +175,7 @@ struct saved_nic {
extern
int
lxc_convert_mac
(
char
*
macaddr
,
struct
sockaddr
*
sockaddr
);
extern
int
lxc_convert_mac
(
char
*
macaddr
,
struct
sockaddr
*
sockaddr
);
/* Move a device between namespaces. */
/* Move a device between namespaces. */
extern
int
lxc_netdev_move_by_index
(
int
ifindex
,
pid_t
pid
,
const
char
*
ifname
);
extern
int
lxc_netdev_move_by_index
(
int
ifindex
,
pid_t
pid
,
const
char
*
ifname
);
extern
int
lxc_netdev_move_by_name
(
const
char
*
ifname
,
pid_t
pid
,
extern
int
lxc_netdev_move_by_name
(
const
char
*
ifname
,
pid_t
pid
,
const
char
*
newname
);
const
char
*
newname
);
...
...
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