dhcpd: drope les macs "<automatique>"

This commit is contained in:
Daniel STAN 2014-02-23 02:13:08 +01:00
parent 47ee3eed1c
commit 4ce302b699

View file

@ -36,6 +36,8 @@ class dydhcp:
@raises OmapiError:
@raises socket.error:
"""
if '<automatique>' in [ip, mac]:
return
msg = OmapiMessage.open(b"host")
msg.message.append((b"create", struct.pack("!I", 1)))
msg.message.append((b"exclusive", struct.pack("!I", 1)))
@ -56,6 +58,8 @@ class dydhcp:
@raises OmapiError:
@raises socket.error:
"""
if '<automatique>' in [ip, mac]:
return
msg = OmapiMessage.open(b"host")
msg.obj.append((b"hardware-address", pack_mac(mac)))
msg.obj.append((b"hardware-type", struct.pack("!I", 1)))
@ -147,7 +151,8 @@ class dhcp(gen_config) :
for machine in self.machines :
self.anim.cycle()
for net in self.reseaux.keys() :
if machine.ip() != '<automatique>' and AddrInNet(machine.ip(), net) :
if '<automatique>' not in [machine.ip(), machine.mac()] and \
AddrInNet(machine.ip(), net):
host_template = self.host_template
# variable pour remplir le template
#d = { 'nom' : machine.nom().split('.')[0] , 'mac' : machine.mac() , 'ip' : machine.ip() }