|
2 |
from univention.config_registry.interfaces import Interfaces |
2 |
from univention.config_registry.interfaces import Interfaces |
3 |
from itertools import groupby |
3 |
from itertools import groupby |
4 |
from operator import itemgetter |
4 |
from operator import itemgetter |
|
|
5 |
try: |
6 |
from shlex import quote |
7 |
except ImportError: |
8 |
from pipes import quote |
5 |
|
9 |
|
6 |
def auto(interface, start): |
10 |
def auto(interface, start): |
7 |
"""Print 'auto iface' statements only once.""" |
11 |
"""Print 'auto iface' statements only once.""" |
Lines 61-67
def ipv4(ucr, interfaces):
|
Link Here
|
---|
|
61 |
for value in iface.options: |
65 |
for value in iface.options: |
62 |
print '\t%s' % (value,) |
66 |
print '\t%s' % (value,) |
63 |
|
67 |
|
64 |
def ipv6(interfaces): |
68 |
def ipv6(ucr, interfaces): |
65 |
"""Setup IPv6.""" |
69 |
"""Setup IPv6.""" |
66 |
gateway = interfaces.ipv6_gateway |
70 |
gateway = interfaces.ipv6_gateway |
67 |
if gateway is False: |
71 |
if gateway is False: |
Lines 104-109
def ipv6(interfaces):
|
Link Here
|
---|
|
104 |
if i == 0: # first |
108 |
if i == 0: # first |
105 |
print '\taddress %s' % (addr.ip,) |
109 |
print '\taddress %s' % (addr.ip,) |
106 |
print '\tnetmask %s' % (addr.prefixlen,) |
110 |
print '\tnetmask %s' % (addr.prefixlen,) |
|
|
111 |
if ucr.is_false(value=iface.get('ipv6/acceptRA')): |
112 |
print '\tup sysctl -q -w net.ipv6.conf.%s.accept_ra=0' % (quote(iface.name),) |
107 |
else: |
113 |
else: |
108 |
print '\tup ip -6 addr add %s dev %s' % (addr.ip, iface.name) |
114 |
print '\tup ip -6 addr add %s dev %s' % (addr.ip, iface.name) |
109 |
print '\tdown ip -6 addr del %s dev %s' % (addr.ip, iface.name) |
115 |
print '\tdown ip -6 addr del %s dev %s' % (addr.ip, iface.name) |
|
129 |
"""Create configured interfaces.""" |
135 |
"""Create configured interfaces.""" |
130 |
interfaces = Interfaces(configRegistry) |
136 |
interfaces = Interfaces(configRegistry) |
131 |
ipv4(configRegistry, interfaces) |
137 |
ipv4(configRegistry, interfaces) |
132 |
ipv6(interfaces) |
138 |
ipv6(configRegistry, interfaces) |
133 |
|
139 |
|
134 |
main() |
140 |
main() |
135 |
# vim:set sw=4 ts=4 noet: |
141 |
# vim:set sw=4 ts=4 noet: |