Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
agent
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
7
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f1dd7a55
authored
Jan 20, 2015
by
Oliver Pinter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comment out the unneeded static routes
parent
12f99067
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
freebsd/network.py
+12
-12
No files found.
freebsd/network.py
View file @
f1dd7a55
...
@@ -44,8 +44,8 @@ def change_ip_freebsd(interfaces, dns):
...
@@ -44,8 +44,8 @@ def change_ip_freebsd(interfaces, dns):
if_file
=
rcconf_dir
+
"ifconfig_"
+
device
if_file
=
rcconf_dir
+
"ifconfig_"
+
device
with
open
(
if_file
,
'w'
)
as
f
:
with
open
(
if_file
,
'w'
)
as
f
:
ipv4_alias_counter
=
ipv6_alias_counter
=
0
ipv4_alias_counter
=
ipv6_alias_counter
=
0
route6
=
"ipv6_static_routes=
\"
"
#
route6 = "ipv6_static_routes=\""
route4
=
"static_routes=
\"
"
#
route4 = "static_routes=\""
for
i
in
conf
[
'addresses'
]:
for
i
in
conf
[
'addresses'
]:
alias
=
""
alias
=
""
ip_with_prefix
=
IPNetwork
(
i
)
ip_with_prefix
=
IPNetwork
(
i
)
...
@@ -58,9 +58,9 @@ def change_ip_freebsd(interfaces, dns):
...
@@ -58,9 +58,9 @@ def change_ip_freebsd(interfaces, dns):
ipv6_alias_counter
+=
1
ipv6_alias_counter
+=
1
f
.
write
(
"ifconfig_"
+
device
+
alias
+
"="
+
f
.
write
(
"ifconfig_"
+
device
+
alias
+
"="
+
"
\"
inet6
%(ip)
s prefixlen
%(pref)
s
\"\n
"
%
{
'ip'
:
ip
,
'pref'
:
prefixlen
})
"
\"
inet6
%(ip)
s prefixlen
%(pref)
s
\"\n
"
%
{
'ip'
:
ip
,
'pref'
:
prefixlen
})
route6_name
=
device
+
"R"
+
str
(
ipv6_alias_counter
)
+
"v6"
#
route6_name=device+"R"+str(ipv6_alias_counter)+"v6"
route6
+=
route6_name
+
":"
+
device
+
" "
#
route6 += route6_name+":"+device+" "
f
.
write
(
"route_"
+
route6_name
+
"=
\"
-net
%(netw)
s0
-gateway
%(gw)
s
\"\n
"
%
{
'netw'
:
ip_with_prefix
.
network
,
'gw'
:
conf
[
'gw6'
]})
#f.write("route_"+route6_name+"=\"-net %(netw)s
-gateway %(gw)s\"\n" % { 'netw' : ip_with_prefix.network, 'gw' : conf['gw6']})
f
.
write
(
"ipv6_defaultrouter=
\"
"
+
str
(
conf
[
'gw6'
])
+
"
\"\n
"
)
f
.
write
(
"ipv6_defaultrouter=
\"
"
+
str
(
conf
[
'gw6'
])
+
"
\"\n
"
)
else
:
else
:
if
ipv4_alias_counter
>
0
:
if
ipv4_alias_counter
>
0
:
...
@@ -69,14 +69,14 @@ def change_ip_freebsd(interfaces, dns):
...
@@ -69,14 +69,14 @@ def change_ip_freebsd(interfaces, dns):
alias
=
'_alias
%
d'
%
(
ipv4_alias_counter
)
alias
=
'_alias
%
d'
%
(
ipv4_alias_counter
)
ipv4_alias_counter
+=
1
ipv4_alias_counter
+=
1
f
.
write
(
"ifconfig_"
+
device
+
alias
+
"="
+
"
\"
inet
%(ip)
s/
%(pref)
s
\"\n
"
%
{
'ip'
:
ip
,
'pref'
:
prefixlen
})
f
.
write
(
"ifconfig_"
+
device
+
alias
+
"="
+
"
\"
inet
%(ip)
s/
%(pref)
s
\"\n
"
%
{
'ip'
:
ip
,
'pref'
:
prefixlen
})
route4_name
=
device
+
"R"
+
str
(
ipv4_alias_counter
)
+
"v4"
#
route4_name=device+"R"+str(ipv4_alias_counter)+"v4"
route4
+=
route4_name
+
":"
+
device
+
" "
#
route4 += route4_name+":"+device+" "
f
.
write
(
"route_"
+
route4_name
+
"=
\"
-net
%(netw)
s -gateway
%(gw)
s
\"\n
"
%
{
'netw'
:
ip_with_prefix
.
network
,
'gw'
:
conf
[
'gw4'
]})
#
f.write("route_"+route4_name+"=\"-net %(netw)s -gateway %(gw)s\"\n" % { 'netw' : ip_with_prefix.network, 'gw' : conf['gw4']})
f
.
write
(
"defaultrouter=
\"
"
+
str
(
conf
[
'gw4'
])
+
"
\"\n
"
)
f
.
write
(
"defaultrouter=
\"
"
+
str
(
conf
[
'gw4'
])
+
"
\"\n
"
)
route4
+=
"
\"\n
"
#
route4 += "\"\n"
route6
+=
"
\"\n
"
#
route6 += "\"\n"
f
.
write
(
route4
)
#
f.write(route4)
f
.
write
(
route6
)
#
f.write(route6)
with
open
(
"/etc/resolv.conf"
,
"w"
)
as
f
:
with
open
(
"/etc/resolv.conf"
,
"w"
)
as
f
:
f
.
write
(
"nameserver "
+
dns
)
f
.
write
(
"nameserver "
+
dns
)
...
...
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