bug fix in address expiration

This commit is contained in:
Gilles Grandou 2020-10-08 11:24:43 +02:00
parent a63bd3a5a5
commit ff4302cf0a

View File

@ -159,17 +159,18 @@ def process_zone(zone, stamp, grace_period, sync_zone):
update = { 'add': [], 'delete': [] }
for prot in zone:
for name in zone[prot]:
add = False
active = False
for addr in zone[prot][name]:
e = zone[prot][name][addr]
if e['first'] == stamp and not sync_zone:
if e['first'] == stamp:
update['add'].append([prot, name, addr])
add = True
if e['last'] == stamp:
active = True
for addr in zone[prot][name]:
e = zone[prot][name][addr]
if add and e['last'] < stamp:
if active and e['last'] < stamp:
update['delete'].append([prot, name, addr])
elif not add and stamp - e['last'] > grace_period:
elif not active and stamp - e['last'] > grace_period:
update['delete'].append([prot, name, addr])
elif sync_zone:
update['add'].append([prot, name, addr])