Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Anders Blomdell
hostinfo
Commits
8867ff1b
Commit
8867ff1b
authored
May 27, 2016
by
Anders Blomdell
Browse files
Fixed defroute handling
parent
c6d8dc3c
Changes
2
Hide whitespace changes
Inline
Side-by-side
.gitignore
0 → 100644
View file @
8867ff1b
/hostinfo
*.pyc
*~
src/hostinfo/ifconfig.py
View file @
8867ff1b
...
@@ -89,6 +89,9 @@ def generate_ifcfgv4(tree, interface, search, nameservers):
...
@@ -89,6 +89,9 @@ def generate_ifcfgv4(tree, interface, search, nameservers):
pass
pass
index
=
int
(
'0%s'
%
index
)
+
1
index
=
int
(
'0%s'
%
index
)
+
1
pass
pass
if
interface
.
defroute
[
0
]:
config
.
append
(
'DEFROUTE=%s'
%
interface
.
defroute
[
0
])
pass
return
config
return
config
...
@@ -97,7 +100,15 @@ def generate_ifcfgv6(tree, interface, search, nameservers):
...
@@ -97,7 +100,15 @@ def generate_ifcfgv6(tree, interface, search, nameservers):
if
not
interface_is_static
(
interface
):
if
not
interface_is_static
(
interface
):
config
.
append
(
'IPV6INIT=yes'
)
config
.
append
(
'IPV6INIT=yes'
)
config
.
append
(
'IPV6_AUTOCONF=yes'
)
config
.
append
(
'IPV6_AUTOCONF=yes'
)
config
.
append
(
'IPV6_DEFROUTE=yes'
)
if
interface
.
ipv6_defroute
[
0
]:
config
.
append
(
'IPV6_DEFROUTE=%s'
%
interface
.
ipv6_defroute
[
0
])
pass
elif
interface
.
defroute
[
0
]:
config
.
append
(
'IPV6_DEFROUTE=%s'
%
interface
.
defroute
[
0
])
pass
else
:
config
.
append
(
'IPV6_DEFROUTE=yes'
)
pass
config
.
append
(
'IPV6_PEERDNS=yes'
)
config
.
append
(
'IPV6_PEERDNS=yes'
)
config
.
append
(
'IPV6_PEERROUTES=yes'
)
config
.
append
(
'IPV6_PEERROUTES=yes'
)
config
.
append
(
'IPV6_FAILURE_FATAL=no'
)
config
.
append
(
'IPV6_FAILURE_FATAL=no'
)
...
@@ -121,7 +132,15 @@ def generate_ifcfgv6(tree, interface, search, nameservers):
...
@@ -121,7 +132,15 @@ def generate_ifcfgv6(tree, interface, search, nameservers):
if
len
(
address
):
if
len
(
address
):
config
.
append
(
'IPV6INIT=yes'
)
config
.
append
(
'IPV6INIT=yes'
)
config
.
append
(
'IPV6_AUTOCONF=no'
)
config
.
append
(
'IPV6_AUTOCONF=no'
)
config
.
append
(
'IPV6_DEFROUTE=yes'
)
if
interface
.
ipv6_defroute
[
0
]:
config
.
append
(
'IPV6_DEFROUTE=%s'
%
interface
.
ipv6_defroute
[
0
])
pass
elif
interface
.
defroute
[
0
]:
config
.
append
(
'IPV6_DEFROUTE=%s'
%
interface
.
defroute
[
0
])
pass
else
:
config
.
append
(
'IPV6_DEFROUTE=yes'
)
pass
config
.
append
(
'IPV6_FAILURE_FATAL=no'
)
config
.
append
(
'IPV6_FAILURE_FATAL=no'
)
config
.
append
(
'IPV6ADDR=%s'
%
address
[
0
])
config
.
append
(
'IPV6ADDR=%s'
%
address
[
0
])
if
gateway
:
if
gateway
:
...
@@ -165,9 +184,6 @@ def generate_ifcfg(tree, interface):
...
@@ -165,9 +184,6 @@ def generate_ifcfg(tree, interface):
tmp
=
sorted
(
search
,
cmp
=
reverse_order
)
tmp
=
sorted
(
search
,
cmp
=
reverse_order
)
config
.
append
(
'SEARCH="%s"'
%
(
' '
.
join
(
tmp
)))
config
.
append
(
'SEARCH="%s"'
%
(
' '
.
join
(
tmp
)))
pass
pass
if
interface
.
defroute
[
0
]:
config
.
append
(
'DEFROUTE=%s'
%
interface
.
defroute
[
0
])
pass
return
'
\n
'
.
join
(
config
)
+
'
\n
'
return
'
\n
'
.
join
(
config
)
+
'
\n
'
...
...
Write
Preview
Supports
Markdown
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