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
b0ee5983
Unverified
Commit
b0ee5983
authored
Jun 03, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: non-functional changes
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
f07fa8df
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
24 deletions
+25
-24
conf.c
src/lxc/conf.c
+25
-24
No files found.
src/lxc/conf.c
View file @
b0ee5983
...
@@ -815,16 +815,16 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha
...
@@ -815,16 +815,16 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha
* :mixed, because then the container can't remount it read-write. */
* :mixed, because then the container can't remount it read-write. */
if
(
cg_flags
==
LXC_AUTO_CGROUP_NOSPEC
||
cg_flags
==
LXC_AUTO_CGROUP_FULL_NOSPEC
)
{
if
(
cg_flags
==
LXC_AUTO_CGROUP_NOSPEC
||
cg_flags
==
LXC_AUTO_CGROUP_FULL_NOSPEC
)
{
int
has_sys_admin
=
0
;
int
has_sys_admin
=
0
;
if
(
!
lxc_list_empty
(
&
conf
->
keepcaps
))
{
if
(
!
lxc_list_empty
(
&
conf
->
keepcaps
))
has_sys_admin
=
in_caplist
(
CAP_SYS_ADMIN
,
&
conf
->
keepcaps
);
has_sys_admin
=
in_caplist
(
CAP_SYS_ADMIN
,
&
conf
->
keepcaps
);
}
else
{
else
has_sys_admin
=
!
in_caplist
(
CAP_SYS_ADMIN
,
&
conf
->
caps
);
has_sys_admin
=
!
in_caplist
(
CAP_SYS_ADMIN
,
&
conf
->
caps
);
}
if
(
cg_flags
==
LXC_AUTO_CGROUP_NOSPEC
)
{
if
(
cg_flags
==
LXC_AUTO_CGROUP_NOSPEC
)
cg_flags
=
has_sys_admin
?
LXC_AUTO_CGROUP_RW
:
LXC_AUTO_CGROUP_MIXED
;
cg_flags
=
has_sys_admin
?
LXC_AUTO_CGROUP_RW
:
LXC_AUTO_CGROUP_MIXED
;
}
else
{
else
cg_flags
=
has_sys_admin
?
LXC_AUTO_CGROUP_FULL_RW
:
LXC_AUTO_CGROUP_FULL_MIXED
;
cg_flags
=
has_sys_admin
?
LXC_AUTO_CGROUP_FULL_RW
:
LXC_AUTO_CGROUP_FULL_MIXED
;
}
}
}
if
(
!
cgroup_mount
(
conf
->
rootfs
.
path
?
conf
->
rootfs
.
mount
:
""
,
handler
,
cg_flags
))
{
if
(
!
cgroup_mount
(
conf
->
rootfs
.
path
?
conf
->
rootfs
.
mount
:
""
,
handler
,
cg_flags
))
{
...
@@ -2764,8 +2764,8 @@ struct lxc_conf *lxc_conf_init(void)
...
@@ -2764,8 +2764,8 @@ struct lxc_conf *lxc_conf_init(void)
static
int
instantiate_veth
(
struct
lxc_handler
*
handler
,
struct
lxc_netdev
*
netdev
)
static
int
instantiate_veth
(
struct
lxc_handler
*
handler
,
struct
lxc_netdev
*
netdev
)
{
{
char
veth1buf
[
IFNAMSIZ
],
*
veth1
;
char
*
veth1
,
*
veth2
;
char
veth
2buf
[
IFNAMSIZ
],
*
veth2
;
char
veth
1buf
[
IFNAMSIZ
],
veth2buf
[
IFNAMSIZ
]
;
int
bridge_index
,
err
;
int
bridge_index
,
err
;
unsigned
int
mtu
=
0
;
unsigned
int
mtu
=
0
;
...
@@ -2797,8 +2797,8 @@ static int instantiate_veth(struct lxc_handler *handler, struct lxc_netdev *netd
...
@@ -2797,8 +2797,8 @@ static int instantiate_veth(struct lxc_handler *handler, struct lxc_netdev *netd
err
=
lxc_veth_create
(
veth1
,
veth2
);
err
=
lxc_veth_create
(
veth1
,
veth2
);
if
(
err
)
{
if
(
err
)
{
ERROR
(
"failed to create veth pair
(%s and %s): %s"
,
veth1
,
veth2
,
ERROR
(
"failed to create veth pair
\"
%s
\"
and
\"
%s
\"
: %s"
,
veth1
,
strerror
(
-
err
));
veth2
,
strerror
(
-
err
));
goto
out_delete
;
goto
out_delete
;
}
}
...
@@ -2807,30 +2807,30 @@ static int instantiate_veth(struct lxc_handler *handler, struct lxc_netdev *netd
...
@@ -2807,30 +2807,30 @@ static int instantiate_veth(struct lxc_handler *handler, struct lxc_netdev *netd
* of a container */
* of a container */
err
=
setup_private_host_hw_addr
(
veth1
);
err
=
setup_private_host_hw_addr
(
veth1
);
if
(
err
)
{
if
(
err
)
{
ERROR
(
"failed to change mac address of host interface
'%s'
: %s"
,
ERROR
(
"failed to change mac address of host interface
\"
%s
\"
: %s"
,
veth1
,
strerror
(
-
err
));
veth1
,
strerror
(
-
err
));
goto
out_delete
;
goto
out_delete
;
}
}
netdev
->
ifindex
=
if_nametoindex
(
veth2
);
netdev
->
ifindex
=
if_nametoindex
(
veth2
);
if
(
!
netdev
->
ifindex
)
{
if
(
!
netdev
->
ifindex
)
{
ERROR
(
"failed to retrieve the index for
%s
"
,
veth2
);
ERROR
(
"failed to retrieve the index for
\"
%s
\"
"
,
veth2
);
goto
out_delete
;
goto
out_delete
;
}
}
if
(
netdev
->
mtu
)
{
if
(
netdev
->
mtu
)
{
if
(
lxc_safe_uint
(
netdev
->
mtu
,
&
mtu
)
<
0
)
if
(
lxc_safe_uint
(
netdev
->
mtu
,
&
mtu
)
<
0
)
WARN
(
"
Failed to parse mtu from.
"
);
WARN
(
"
failed to parse mtu from
"
);
else
else
INFO
(
"
R
etrieved mtu %d"
,
mtu
);
INFO
(
"
r
etrieved mtu %d"
,
mtu
);
}
else
if
(
netdev
->
link
)
{
}
else
if
(
netdev
->
link
)
{
bridge_index
=
if_nametoindex
(
netdev
->
link
);
bridge_index
=
if_nametoindex
(
netdev
->
link
);
if
(
bridge_index
)
{
if
(
bridge_index
)
{
mtu
=
netdev_get_mtu
(
bridge_index
);
mtu
=
netdev_get_mtu
(
bridge_index
);
INFO
(
"
R
etrieved mtu %d from %s"
,
mtu
,
netdev
->
link
);
INFO
(
"
r
etrieved mtu %d from %s"
,
mtu
,
netdev
->
link
);
}
else
{
}
else
{
mtu
=
netdev_get_mtu
(
netdev
->
ifindex
);
mtu
=
netdev_get_mtu
(
netdev
->
ifindex
);
INFO
(
"
R
etrieved mtu %d from %s"
,
mtu
,
veth2
);
INFO
(
"
r
etrieved mtu %d from %s"
,
mtu
,
veth2
);
}
}
}
}
...
@@ -2839,7 +2839,8 @@ static int instantiate_veth(struct lxc_handler *handler, struct lxc_netdev *netd
...
@@ -2839,7 +2839,8 @@ static int instantiate_veth(struct lxc_handler *handler, struct lxc_netdev *netd
if
(
!
err
)
if
(
!
err
)
err
=
lxc_netdev_set_mtu
(
veth2
,
mtu
);
err
=
lxc_netdev_set_mtu
(
veth2
,
mtu
);
if
(
err
)
{
if
(
err
)
{
ERROR
(
"failed to set mtu '%i' for veth pair (%s and %s): %s"
,
ERROR
(
"failed to set mtu
\"
%d
\"
for veth pair
\"
%s
\"
"
"and
\"
%s
\"
: %s"
,
mtu
,
veth1
,
veth2
,
strerror
(
-
err
));
mtu
,
veth1
,
veth2
,
strerror
(
-
err
));
goto
out_delete
;
goto
out_delete
;
}
}
...
@@ -2848,16 +2849,16 @@ static int instantiate_veth(struct lxc_handler *handler, struct lxc_netdev *netd
...
@@ -2848,16 +2849,16 @@ static int instantiate_veth(struct lxc_handler *handler, struct lxc_netdev *netd
if
(
netdev
->
link
)
{
if
(
netdev
->
link
)
{
err
=
lxc_bridge_attach
(
handler
->
lxcpath
,
handler
->
name
,
netdev
->
link
,
veth1
);
err
=
lxc_bridge_attach
(
handler
->
lxcpath
,
handler
->
name
,
netdev
->
link
,
veth1
);
if
(
err
)
{
if
(
err
)
{
ERROR
(
"failed to attach
'%s' to the bridge '%s'
: %s"
,
ERROR
(
"failed to attach
\"
%s
\"
to bridge
\"
%s
\"
: %s"
,
veth1
,
netdev
->
link
,
strerror
(
-
err
));
veth1
,
netdev
->
link
,
strerror
(
-
err
));
goto
out_delete
;
goto
out_delete
;
}
}
INFO
(
"
Attached '%s': to the bridge '%s':
"
,
veth1
,
netdev
->
link
);
INFO
(
"
attached
\"
%s
\"
to bridge
\"
%s
\"
"
,
veth1
,
netdev
->
link
);
}
}
err
=
lxc_netdev_up
(
veth1
);
err
=
lxc_netdev_up
(
veth1
);
if
(
err
)
{
if
(
err
)
{
ERROR
(
"failed to set
%s up
: %s"
,
veth1
,
strerror
(
-
err
));
ERROR
(
"failed to set
\"
%s
\"
up
: %s"
,
veth1
,
strerror
(
-
err
));
goto
out_delete
;
goto
out_delete
;
}
}
...
@@ -2868,8 +2869,8 @@ static int instantiate_veth(struct lxc_handler *handler, struct lxc_netdev *netd
...
@@ -2868,8 +2869,8 @@ static int instantiate_veth(struct lxc_handler *handler, struct lxc_netdev *netd
goto
out_delete
;
goto
out_delete
;
}
}
DEBUG
(
"instantiated veth
'%s/%s', index is '%d'"
,
DEBUG
(
"instantiated veth
\"
%s/%s
\"
, index is
\"
%d
\"
"
,
veth1
,
veth2
,
veth1
,
veth2
,
netdev
->
ifindex
);
netdev
->
ifindex
);
return
0
;
return
0
;
...
...
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