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
c7dc0721
Commit
c7dc0721
authored
Oct 27, 2016
by
Christian Brauner
Committed by
Stéphane Graber
Nov 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: explicitly remove veth device from host
Signed-off-by:
Christian Brauner
<
christian.brauner@canonical.com
>
parent
ed8e8611
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
8 deletions
+34
-8
conf.c
src/lxc/conf.c
+34
-8
No files found.
src/lxc/conf.c
View file @
c7dc0721
...
@@ -2882,6 +2882,7 @@ int lxc_create_network(struct lxc_handler *handler)
...
@@ -2882,6 +2882,7 @@ int lxc_create_network(struct lxc_handler *handler)
void
lxc_delete_network
(
struct
lxc_handler
*
handler
)
void
lxc_delete_network
(
struct
lxc_handler
*
handler
)
{
{
int
ret
;
struct
lxc_list
*
network
=
&
handler
->
conf
->
network
;
struct
lxc_list
*
network
=
&
handler
->
conf
->
network
;
struct
lxc_list
*
iterator
;
struct
lxc_list
*
iterator
;
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
;
...
@@ -2891,24 +2892,49 @@ void lxc_delete_network(struct lxc_handler *handler)
...
@@ -2891,24 +2892,49 @@ void lxc_delete_network(struct lxc_handler *handler)
if
(
netdev
->
ifindex
!=
0
&&
netdev
->
type
==
LXC_NET_PHYS
)
{
if
(
netdev
->
ifindex
!=
0
&&
netdev
->
type
==
LXC_NET_PHYS
)
{
if
(
lxc_netdev_rename_by_index
(
netdev
->
ifindex
,
netdev
->
link
))
if
(
lxc_netdev_rename_by_index
(
netdev
->
ifindex
,
netdev
->
link
))
WARN
(
"
f
ailed to rename to the initial name the "
\
WARN
(
"
F
ailed to rename to the initial name the "
\
"netdev '%s'"
,
netdev
->
link
);
"netdev '%s'"
,
netdev
->
link
);
continue
;
continue
;
}
}
if
(
netdev_deconf
[
netdev
->
type
](
handler
,
netdev
))
{
if
(
netdev_deconf
[
netdev
->
type
](
handler
,
netdev
))
{
WARN
(
"
f
ailed to destroy netdev"
);
WARN
(
"
F
ailed to destroy netdev"
);
}
}
/* Recent kernel remove the virtual interfaces when the network
/* Recent kernel remove the virtual interfaces when the network
* namespace is destroyed but in case we did not moved the
* namespace is destroyed but in case we did not moved the
* interface to the network namespace, we have to destroy it
* interface to the network namespace, we have to destroy it
*/
*/
if
(
netdev
->
ifindex
!=
0
&&
if
(
netdev
->
ifindex
!=
0
)
{
lxc_netdev_delete_by_index
(
netdev
->
ifindex
))
ret
=
lxc_netdev_delete_by_index
(
netdev
->
ifindex
);
WARN
(
"failed to remove interface %d '%s'"
,
if
(
ret
<
0
)
netdev
->
ifindex
,
WARN
(
"Failed to remove interface %d '%s': %s."
,
netdev
->
name
?
netdev
->
name
:
"(null)"
);
netdev
->
ifindex
,
netdev
->
name
?
netdev
->
name
:
"(null)"
,
strerror
(
-
ret
));
else
INFO
(
"Removed interface %d '%s'."
,
netdev
->
ifindex
,
netdev
->
name
?
netdev
->
name
:
"(null)"
);
}
/* Explicitly delete host veth device to prevent lingering
* devices. We had issues in LXD around this.
*/
if
(
netdev
->
type
==
LXC_NET_VETH
)
{
char
*
hostveth
=
NULL
;
if
(
netdev
->
priv
.
veth_attr
.
pair
)
hostveth
=
netdev
->
priv
.
veth_attr
.
pair
;
else
if
(
strlen
(
netdev
->
priv
.
veth_attr
.
veth1
)
>
0
)
hostveth
=
netdev
->
priv
.
veth_attr
.
veth1
;
if
(
hostveth
)
{
ret
=
lxc_netdev_delete_by_name
(
hostveth
);
if
(
ret
<
0
)
WARN
(
"Failed to remove '%s' from host."
,
hostveth
);
else
INFO
(
"Deleted '%s' from host."
,
hostveth
);
}
}
}
}
}
}
...
...
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