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
e088e926
Commit
e088e926
authored
Jan 28, 2015
by
Stéphane Graber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix clearing IPv4/IPv6 addresses
Signed-off-by:
Stéphane Graber
<
stgraber@ubuntu.com
>
Acked-by:
Serge E. Hallyn
<
serge.hallyn@ubuntu.com
>
parent
9f177a00
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
19 deletions
+16
-19
confile.c
src/lxc/confile.c
+16
-19
No files found.
src/lxc/confile.c
View file @
e088e926
...
...
@@ -787,29 +787,27 @@ static int config_network_ipv4_gateway(const char *key, const char *value,
struct
lxc_conf
*
lxc_conf
)
{
struct
lxc_netdev
*
netdev
;
struct
in_addr
*
gw
;
netdev
=
network_netdev
(
key
,
value
,
&
lxc_conf
->
network
);
if
(
!
netdev
)
return
-
1
;
gw
=
malloc
(
sizeof
(
*
gw
));
if
(
!
gw
)
{
SYSERROR
(
"failed to allocate ipv4 gateway address"
);
return
-
1
;
}
if
(
!
value
)
{
ERROR
(
"no ipv4 gateway address specified"
);
free
(
gw
);
return
-
1
;
}
free
(
netdev
->
ipv4_gateway
);
if
(
!
strcmp
(
value
,
"auto"
))
{
free
(
gw
);
if
(
!
value
||
strlen
(
value
)
==
0
)
{
netdev
->
ipv4_gateway
=
NULL
;
}
else
if
(
!
strcmp
(
value
,
"auto"
))
{
netdev
->
ipv4_gateway
=
NULL
;
netdev
->
ipv4_gateway_auto
=
true
;
}
else
{
struct
in_addr
*
gw
;
gw
=
malloc
(
sizeof
(
*
gw
));
if
(
!
gw
)
{
SYSERROR
(
"failed to allocate ipv4 gateway address"
);
return
-
1
;
}
if
(
!
inet_pton
(
AF_INET
,
value
,
gw
))
{
SYSERROR
(
"invalid ipv4 gateway address: %s"
,
value
);
free
(
gw
);
...
...
@@ -892,12 +890,11 @@ static int config_network_ipv6_gateway(const char *key, const char *value,
if
(
!
netdev
)
return
-
1
;
if
(
!
value
)
{
ERROR
(
"no ipv6 gateway address specified"
);
return
-
1
;
}
free
(
netdev
->
ipv6_gateway
);
if
(
!
strcmp
(
value
,
"auto"
))
{
if
(
!
value
||
strlen
(
value
)
==
0
)
{
netdev
->
ipv4_gateway
=
NULL
;
}
else
if
(
!
strcmp
(
value
,
"auto"
))
{
netdev
->
ipv6_gateway
=
NULL
;
netdev
->
ipv6_gateway_auto
=
true
;
}
else
{
...
...
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