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
aa2fdfd3
Unverified
Commit
aa2fdfd3
authored
Jan 08, 2019
by
hn
Committed by
Christian Brauner
Jan 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: prefix veth interface name with uid info
Signed-off-by:
Hajo Noerenberg
<
hajo-github@noerenberg.de
>
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
2fa5dff9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
lxc_user_nic.c
src/lxc/cmd/lxc_user_nic.c
+7
-1
No files found.
src/lxc/cmd/lxc_user_nic.c
View file @
aa2fdfd3
...
@@ -711,6 +711,7 @@ static char *get_nic_if_avail(int fd, struct alloted_s *names, int pid,
...
@@ -711,6 +711,7 @@ static char *get_nic_if_avail(int fd, struct alloted_s *names, int pid,
struct
stat
sb
;
struct
stat
sb
;
struct
alloted_s
*
n
;
struct
alloted_s
*
n
;
char
*
buf
=
NULL
;
char
*
buf
=
NULL
;
uid_t
uid
;
for
(
n
=
names
;
n
!=
NULL
;
n
=
n
->
next
)
for
(
n
=
names
;
n
!=
NULL
;
n
=
n
->
next
)
cull_entries
(
fd
,
n
->
name
,
intype
,
br
,
NULL
,
NULL
);
cull_entries
(
fd
,
n
->
name
,
intype
,
br
,
NULL
,
NULL
);
...
@@ -753,7 +754,12 @@ static char *get_nic_if_avail(int fd, struct alloted_s *names, int pid,
...
@@ -753,7 +754,12 @@ static char *get_nic_if_avail(int fd, struct alloted_s *names, int pid,
if
(
!
owner
)
if
(
!
owner
)
return
NULL
;
return
NULL
;
ret
=
snprintf
(
nicname
,
sizeof
(
nicname
),
"vethXXXXXX"
);
uid
=
getuid
();
/* for POSIX integer uids the network device name schema is vethUID_XXXXX */
if
(
uid
>
0
&&
uid
<=
65536
)
ret
=
snprintf
(
nicname
,
sizeof
(
nicname
),
"veth%d_XXXXX"
,
uid
);
else
ret
=
snprintf
(
nicname
,
sizeof
(
nicname
),
"vethXXXXXX"
);
if
(
ret
<
0
||
(
size_t
)
ret
>=
sizeof
(
nicname
))
if
(
ret
<
0
||
(
size_t
)
ret
>=
sizeof
(
nicname
))
return
NULL
;
return
NULL
;
...
...
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