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
bd72001f
Unverified
Commit
bd72001f
authored
Jan 11, 2019
by
Wolfgang Bumiller
Committed by
GitHub
Jan 11, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2781 from brauner/hn-veth-uid
network: prefix veth interface name with uid info
parents
421a68d6
aa2fdfd3
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 @
bd72001f
...
...
@@ -711,6 +711,7 @@ static char *get_nic_if_avail(int fd, struct alloted_s *names, int pid,
struct
stat
sb
;
struct
alloted_s
*
n
;
char
*
buf
=
NULL
;
uid_t
uid
;
for
(
n
=
names
;
n
!=
NULL
;
n
=
n
->
next
)
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,
if
(
!
owner
)
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
))
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