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
9c238bc6
Unverified
Commit
9c238bc6
authored
Jul 05, 2019
by
Christian Brauner
Committed by
GitHub
Jul 05, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3081 from brauner/2019-07-05/network_unification_fixes
start: call lxc_find_gateway_addresses early
parents
306ca14a
03ca4af8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
18 deletions
+13
-18
network.c
src/lxc/network.c
+5
-18
start.c
src/lxc/start.c
+8
-0
No files found.
src/lxc/network.c
View file @
9c238bc6
...
@@ -2473,8 +2473,7 @@ int lxc_find_gateway_addresses(struct lxc_handler *handler)
...
@@ -2473,8 +2473,7 @@ int lxc_find_gateway_addresses(struct lxc_handler *handler)
continue
;
continue
;
if
(
netdev
->
type
!=
LXC_NET_VETH
&&
netdev
->
type
!=
LXC_NET_MACVLAN
)
{
if
(
netdev
->
type
!=
LXC_NET_VETH
&&
netdev
->
type
!=
LXC_NET_MACVLAN
)
{
ERROR
(
"Automatic gateway detection is only supported "
ERROR
(
"Automatic gateway detection is only supported for veth and macvlan"
);
"for veth and macvlan"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -2489,16 +2488,16 @@ int lxc_find_gateway_addresses(struct lxc_handler *handler)
...
@@ -2489,16 +2488,16 @@ int lxc_find_gateway_addresses(struct lxc_handler *handler)
if
(
netdev
->
ipv4_gateway_auto
)
{
if
(
netdev
->
ipv4_gateway_auto
)
{
if
(
lxc_ipv4_addr_get
(
link_index
,
&
netdev
->
ipv4_gateway
))
{
if
(
lxc_ipv4_addr_get
(
link_index
,
&
netdev
->
ipv4_gateway
))
{
ERROR
(
"Failed to automatically find ipv4 gateway
"
ERROR
(
"Failed to automatically find ipv4 gateway
address from link interface
\"
%s
\"
"
,
"address from link interface
\"
%s
\"
"
,
netdev
->
link
);
netdev
->
link
);
return
-
1
;
return
-
1
;
}
}
}
}
if
(
netdev
->
ipv6_gateway_auto
)
{
if
(
netdev
->
ipv6_gateway_auto
)
{
if
(
lxc_ipv6_addr_get
(
link_index
,
&
netdev
->
ipv6_gateway
))
{
if
(
lxc_ipv6_addr_get
(
link_index
,
&
netdev
->
ipv6_gateway
))
{
ERROR
(
"Failed to automatically find ipv6 gateway
"
ERROR
(
"Failed to automatically find ipv6 gateway
address from link interface
\"
%s
\"
"
,
"address from link interface
\"
%s
\"
"
,
netdev
->
link
);
netdev
->
link
);
return
-
1
;
return
-
1
;
}
}
}
}
...
@@ -4036,18 +4035,6 @@ int lxc_create_network(struct lxc_handler *handler)
...
@@ -4036,18 +4035,6 @@ int lxc_create_network(struct lxc_handler *handler)
{
{
int
ret
;
int
ret
;
/*
* Find gateway addresses from the link device, which is no longer
* accessible inside the container. Do this before creating network
* interfaces, since goto out_delete_net does not work before
* lxc_clone.
*/
ret
=
lxc_find_gateway_addresses
(
handler
);
if
(
ret
)
{
ERROR
(
"Failed to find gateway addresses"
);
return
-
1
;
}
if
(
handler
->
am_root
)
{
if
(
handler
->
am_root
)
{
ret
=
lxc_create_network_priv
(
handler
);
ret
=
lxc_create_network_priv
(
handler
);
if
(
ret
)
if
(
ret
)
...
...
src/lxc/start.c
View file @
9c238bc6
...
@@ -1697,6 +1697,14 @@ static int lxc_spawn(struct lxc_handler *handler)
...
@@ -1697,6 +1697,14 @@ static int lxc_spawn(struct lxc_handler *handler)
if
(
ret
<
0
)
if
(
ret
<
0
)
goto
out_sync_fini
;
goto
out_sync_fini
;
if
(
handler
->
ns_clone_flags
&
CLONE_NEWNET
)
{
ret
=
lxc_find_gateway_addresses
(
handler
);
if
(
ret
)
{
ERROR
(
"Failed to find gateway addresses"
);
goto
out_sync_fini
;
}
}
if
(
!
cgroup_ops
->
payload_create
(
cgroup_ops
,
handler
))
{
if
(
!
cgroup_ops
->
payload_create
(
cgroup_ops
,
handler
))
{
ERROR
(
"Failed creating cgroups"
);
ERROR
(
"Failed creating cgroups"
);
goto
out_delete_net
;
goto
out_delete_net
;
...
...
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