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
4d781681
Commit
4d781681
authored
Jun 09, 2018
by
harryoooooooooo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug: unpriv lxc will run lxc.net.[i].script.up now
Signed-off-by:
harryoooooooooo
<
ymsc27884@gmail.com
>
parent
9b7f09d1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
5 deletions
+20
-5
network.c
src/lxc/network.c
+18
-3
network.h
src/lxc/network.h
+1
-1
start.c
src/lxc/start.c
+1
-1
No files found.
src/lxc/network.c
View file @
4d781681
...
@@ -2097,7 +2097,7 @@ int lxc_find_gateway_addresses(struct lxc_handler *handler)
...
@@ -2097,7 +2097,7 @@ int lxc_find_gateway_addresses(struct lxc_handler *handler)
#define LXC_USERNIC_PATH LIBEXECDIR "/lxc/lxc-user-nic"
#define LXC_USERNIC_PATH LIBEXECDIR "/lxc/lxc-user-nic"
static
int
lxc_create_network_unpriv_exec
(
const
char
*
lxcpath
,
const
char
*
lxcname
,
static
int
lxc_create_network_unpriv_exec
(
const
char
*
lxcpath
,
const
char
*
lxcname
,
struct
lxc_netdev
*
netdev
,
pid_t
pid
)
struct
lxc_netdev
*
netdev
,
pid_t
pid
,
unsigned
int
hooks_version
)
{
{
int
ret
;
int
ret
;
pid_t
child
;
pid_t
child
;
...
@@ -2242,6 +2242,21 @@ static int lxc_create_network_unpriv_exec(const char *lxcpath, const char *lxcna
...
@@ -2242,6 +2242,21 @@ static int lxc_create_network_unpriv_exec(const char *lxcpath, const char *lxcna
return
-
1
;
return
-
1
;
}
}
if
(
netdev
->
upscript
)
{
char
*
argv
[]
=
{
"veth"
,
netdev
->
link
,
netdev
->
priv
.
veth_attr
.
veth1
,
NULL
,
};
ret
=
run_script_argv
(
lxcname
,
hooks_version
,
"net"
,
netdev
->
upscript
,
"up"
,
argv
);
if
(
ret
<
0
)
return
-
1
;
}
return
0
;
return
0
;
}
}
...
@@ -2499,7 +2514,7 @@ int lxc_network_move_created_netdev_priv(const char *lxcpath, const char *lxcnam
...
@@ -2499,7 +2514,7 @@ int lxc_network_move_created_netdev_priv(const char *lxcpath, const char *lxcnam
}
}
int
lxc_create_network_unpriv
(
const
char
*
lxcpath
,
const
char
*
lxcname
,
int
lxc_create_network_unpriv
(
const
char
*
lxcpath
,
const
char
*
lxcname
,
struct
lxc_list
*
network
,
pid_t
pid
)
struct
lxc_list
*
network
,
pid_t
pid
,
unsigned
int
hooks_version
)
{
{
struct
lxc_list
*
iterator
;
struct
lxc_list
*
iterator
;
...
@@ -2525,7 +2540,7 @@ int lxc_create_network_unpriv(const char *lxcpath, const char *lxcname,
...
@@ -2525,7 +2540,7 @@ int lxc_create_network_unpriv(const char *lxcpath, const char *lxcname,
if
(
netdev
->
mtu
)
if
(
netdev
->
mtu
)
INFO
(
"mtu ignored due to insufficient privilege"
);
INFO
(
"mtu ignored due to insufficient privilege"
);
if
(
lxc_create_network_unpriv_exec
(
lxcpath
,
lxcname
,
netdev
,
pid
))
if
(
lxc_create_network_unpriv_exec
(
lxcpath
,
lxcname
,
netdev
,
pid
,
hooks_version
))
return
-
1
;
return
-
1
;
}
}
...
...
src/lxc/network.h
View file @
4d781681
...
@@ -263,7 +263,7 @@ extern int lxc_network_move_created_netdev_priv(const char *lxcpath,
...
@@ -263,7 +263,7 @@ extern int lxc_network_move_created_netdev_priv(const char *lxcpath,
extern
void
lxc_delete_network
(
struct
lxc_handler
*
handler
);
extern
void
lxc_delete_network
(
struct
lxc_handler
*
handler
);
extern
int
lxc_find_gateway_addresses
(
struct
lxc_handler
*
handler
);
extern
int
lxc_find_gateway_addresses
(
struct
lxc_handler
*
handler
);
extern
int
lxc_create_network_unpriv
(
const
char
*
lxcpath
,
const
char
*
lxcname
,
extern
int
lxc_create_network_unpriv
(
const
char
*
lxcpath
,
const
char
*
lxcname
,
struct
lxc_list
*
network
,
pid_t
pid
);
struct
lxc_list
*
network
,
pid_t
pid
,
unsigned
int
hook_version
);
extern
int
lxc_requests_empty_network
(
struct
lxc_handler
*
handler
);
extern
int
lxc_requests_empty_network
(
struct
lxc_handler
*
handler
);
extern
int
lxc_restore_phys_nics_to_netns
(
struct
lxc_handler
*
handler
);
extern
int
lxc_restore_phys_nics_to_netns
(
struct
lxc_handler
*
handler
);
extern
int
lxc_setup_network_in_child_namespaces
(
const
struct
lxc_conf
*
conf
,
extern
int
lxc_setup_network_in_child_namespaces
(
const
struct
lxc_conf
*
conf
,
...
...
src/lxc/start.c
View file @
4d781681
...
@@ -1707,7 +1707,7 @@ static int lxc_spawn(struct lxc_handler *handler)
...
@@ -1707,7 +1707,7 @@ static int lxc_spawn(struct lxc_handler *handler)
}
}
ret
=
lxc_create_network_unpriv
(
handler
->
lxcpath
,
handler
->
name
,
ret
=
lxc_create_network_unpriv
(
handler
->
lxcpath
,
handler
->
name
,
&
conf
->
network
,
handler
->
pid
);
&
conf
->
network
,
handler
->
pid
,
conf
->
hooks_version
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
ERROR
(
"Failed to create the configured network"
);
ERROR
(
"Failed to create the configured network"
);
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