|
71 |
#} |
71 |
#} |
72 |
@!@ |
72 |
@!@ |
73 |
import random |
73 |
import random |
74 |
import time |
|
|
75 |
import os.path |
74 |
import os.path |
76 |
from datetime import datetime |
75 |
from datetime import datetime, timedelta |
77 |
|
76 |
|
78 |
if configRegistry.is_true('dhclient/linklocal/fallback', True): |
77 |
if configRegistry.is_true('dhclient/linklocal/fallback', True): |
79 |
for k in configRegistry.keys(): |
78 |
for k in configRegistry.keys(): |
Lines 87-93
if configRegistry.is_true('dhclient/linklocal/fallback', True):
|
Link Here
|
---|
|
87 |
if not current_addr.startswith('169.254.'): |
86 |
if not current_addr.startswith('169.254.'): |
88 |
current_addr = '169.254.%s.%s' % (r1, r2) |
87 |
current_addr = '169.254.%s.%s' % (r1, r2) |
89 |
|
88 |
|
90 |
d = datetime.fromtimestamp(time.time() + (6*3600)) # expire in six hours |
89 |
d = datetime.now() + timedelta(hours=6) # expire in six hours |
91 |
|
90 |
|
92 |
print 'lease {' |
91 |
print 'lease {' |
93 |
print ' interface "%s";' % (iface) |
92 |
print ' interface "%s";' % (iface) |
Lines 95-101
if configRegistry.is_true('dhclient/linklocal/fallback', True):
|
Link Here
|
---|
|
95 |
print ' option subnet-mask 255.255.0.0;' |
94 |
print ' option subnet-mask 255.255.0.0;' |
96 |
print ' option broadcast-address 169.254.255.255;' |
95 |
print ' option broadcast-address 169.254.255.255;' |
97 |
# Format form 'man dhclient.conf: <weekday> <year>/<month>/<day> <hour>:<minute>:<second> |
96 |
# Format form 'man dhclient.conf: <weekday> <year>/<month>/<day> <hour>:<minute>:<second> |
98 |
print ' expire %d %d/%d/%d %s:%s:%s;' % (d.weekday(), d.year, d.month, d.day, str(d.hour).zfill(2), str(d.minute).zfill(2), str(d.second).zfill(2)) |
97 |
print d.strftime(' expire %w %Y/%m/%d %H:%M:%S;') |
99 |
print '}' |
98 |
print '}' |
100 |
|
99 |
|
101 |
LOCAL = '/etc/dhcp/dhclient.conf.local' |
100 |
LOCAL = '/etc/dhcp/dhclient.conf.local' |