dhcpd: corrige omapi (my fault)

This commit is contained in:
Daniel STAN 2015-02-24 16:39:55 +01:00
parent 9f23c4a5d9
commit c0c36e50dc
2 changed files with 8 additions and 3 deletions

View file

@ -16,9 +16,10 @@ delattr(sys, 'argv')
auth.instantiate(())
# Test avec l'interface wifi d'apprentis
p=(
('Calling-Station-Id', 'b0:79:94:cf:d1:9a'),
('User-Name', 'moo-torola'),
('Calling-Station-Id', '02:69:75:42:24:03'),
('User-Name', 'apprentis-wifi'),
)
print repr(auth.authorize_wifi(p))

View file

@ -48,11 +48,15 @@ class dydhcp:
msg.obj.append((b"hardware-address", pack_mac(mac)))
msg.obj.append((b"hardware-type", struct.pack("!I", 1)))
msg.obj.append((b"ip-address", pack_ip(ip)))
# See patch for hostnames at
# http://jpmens.net/2011/07/20/dynamically-add-static-leases-to-dhcpd/
if name:
statem = b'supersede host-name "%s";' % bytes(name)
msg.obj.append((b"name", bytes(name)))
msg.obj.append((b"client-hostname", bytes(name)))
msg.obj.append((b"statements", statem))
conn=Omapi(self.server, 9991,self.dhcp_omapi_keyname, self.dhcp_omapi_key)
response = conn.query_server(msg)
# print response.dump() # DEBUG purpose (repr() marche po)
conn.close()
def del_host(self, ip,mac):