projects
/
invirt/packages/invirt-dhcp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update packaging to dh7
[invirt/packages/invirt-dhcp.git]
/
invirt-dhcpserver
diff --git
a/invirt-dhcpserver
b/invirt-dhcpserver
index
9f6fb68
..
2c36b22
100755
(executable)
--- a/
invirt-dhcpserver
+++ b/
invirt-dhcpserver
@@
-31,7
+31,7
@@
class DhcpBackend:
nic = self.findNIC(str(chaddr))
if nic is None or nic.ip is None:
return None
nic = self.findNIC(str(chaddr))
if nic is None or nic.ip is None:
return None
- ipstr = ''.join(reversed(['%02X' % i for i in ipv4(nic.ip).list()]))
+ ipstr = ''.join(reversed(['%02X' % i for i in ipv4(nic.ip.encode("utf-8")).list()]))
for line in open('/proc/net/route'):
parts = line.split()
if parts[1] == ipstr:
for line in open('/proc/net/route'):
parts = line.split()
if parts[1] == ipstr:
@@
-97,15
+97,15
@@
class DhcpBackend:
nic = self.findNIC(str(chaddr))
if nic is None or nic.machine is None:
return False
nic = self.findNIC(str(chaddr))
if nic is None or nic.machine is None:
return False
- ip = nic.ip
+ ip = nic.ip.encode("utf-8")
if ip is None: #Deactivated?
return False
options = {}
if nic.hostname and '.' in nic.hostname:
if ip is None: #Deactivated?
return False
options = {}
if nic.hostname and '.' in nic.hostname:
- options['host_name'], options['domain_name'] = nic.hostname.split('.', 1)
+ options['host_name'], options['domain_name'] = nic.hostname.encode('utf-8').split('.', 1)
elif nic.machine.name:
elif nic.machine.name:
- options['host_name'] = nic.machine.name
+ options['host_name'] = nic.machine.name.encode('utf-8')
options['domain_name'] = config.dns.domains[0]
else:
hostname = None
options['domain_name'] = config.dns.domains[0]
else:
hostname = None
@@
-262,7
+262,7
@@
if '__main__' == __name__:
print "invirt-dhcpserver: cannot determine local IP address by looking up %s" % socket.gethostname()
sys.exit(1)
print "invirt-dhcpserver: cannot determine local IP address by looking up %s" % socket.gethostname()
sys.exit(1)
- dhcp_options['server_identifier'] = myip
+ dhcp_options['server_identifier'] = ipv4(myip).int()
backend = DhcpBackend()
server = DhcpServer(backend, options)
backend = DhcpBackend()
server = DhcpServer(backend, options)