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
306ca14a
Unverified
Commit
306ca14a
authored
Jul 03, 2019
by
Stéphane Graber
Committed by
GitHub
Jul 03, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3077 from brauner/2019-07-03/network_fixes
network: simplify lxc_network_move_created_netdev_priv()
parents
a70d78cd
24190194
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
15 deletions
+7
-15
network.c
src/lxc/network.c
+7
-15
No files found.
src/lxc/network.c
View file @
306ca14a
...
...
@@ -217,6 +217,8 @@ static int instantiate_veth(struct lxc_handler *handler, struct lxc_netdev *netd
goto
out_delete
;
}
strlcpy
(
netdev
->
created_name
,
veth2
,
IFNAMSIZ
);
/* changing the high byte of the mac address to 0xfe, the bridge interface
* will always keep the host's mac address and not take the mac address
* of a container */
...
...
@@ -3144,31 +3146,21 @@ int lxc_network_move_created_netdev_priv(struct lxc_handler *handler)
lxc_list_for_each
(
iterator
,
network
)
{
int
ret
;
char
ifname
[
IFNAMSIZ
];
struct
lxc_netdev
*
netdev
=
iterator
->
elem
;
if
(
!
netdev
->
ifindex
)
continue
;
/* retrieve the name of the interface */
if
(
!
if_indextoname
(
netdev
->
ifindex
,
ifname
))
{
ERROR
(
"No interface corresponding to ifindex
\"
%d
\"
"
,
netdev
->
ifindex
);
return
-
1
;
}
ret
=
lxc_netdev_move_by_name
(
ifname
,
pid
,
NULL
);
ret
=
lxc_netdev_move_by_index
(
netdev
->
ifindex
,
pid
,
NULL
);
if
(
ret
)
{
errno
=
-
ret
;
SYSERROR
(
"Failed to move network device
\"
%s
\"
to network namespace %d"
,
ifname
,
pid
);
SYSERROR
(
"Failed to move network device
\"
%s
\"
with ifindex %d
to network namespace %d"
,
netdev
->
created_name
,
netdev
->
ifindex
,
pid
);
return
-
1
;
}
strlcpy
(
netdev
->
created_name
,
ifname
,
IFNAMSIZ
);
DEBUG
(
"Moved network device
\"
%s
\"
to network namespace of %d"
,
netdev
->
created_name
,
pid
);
DEBUG
(
"Moved network device
\"
%s
\"
with ifindex %d to network namespace of %d"
,
netdev
->
created_name
,
netdev
->
ifindex
,
pid
);
}
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