Update serial number correctly
This commit is contained in:
parent
663133f9cb
commit
8447fa0db9
1 changed files with 12 additions and 0 deletions
12
lib.py
12
lib.py
|
@ -82,6 +82,17 @@ def get_serial(dns_zone):
|
|||
|
||||
return serial
|
||||
|
||||
def update_serial(serial, serial_bits=32):
|
||||
"""Update serial number
|
||||
|
||||
According to RFC 1982 and Knot implementation.
|
||||
SERIAL_BITS = 32 by default.
|
||||
"""
|
||||
|
||||
serial = serial + 1 % 2**32
|
||||
|
||||
return serial
|
||||
|
||||
def soa_handler(re2o_zone, dns_zone):
|
||||
"""Handler for SOA record"""
|
||||
|
||||
|
@ -93,6 +104,7 @@ def soa_handler(re2o_zone, dns_zone):
|
|||
|
||||
origin = dns_zone.origin
|
||||
serial = get_serial(origin)
|
||||
serial = update_serial(serial)
|
||||
logging.debug(f"[SOA] zone_origin={origin} serial={serial}")
|
||||
|
||||
soa_obj = SOA.SOA(
|
||||
|
|
Loading…
Reference in a new issue