]> granicus.if.org Git - pdns/commitdiff
INCEPTION-INCREMENT: avoid jumping by two on every increase
authorChristian Hofstaedtler <christian.hofstaedtler@deduktiva.com>
Thu, 6 Oct 2016 22:04:40 +0000 (00:04 +0200)
committerChris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Fri, 5 Jan 2018 22:32:05 +0000 (23:32 +0100)
Fixes #2377 (which is now also seen by pdnsutil increase-serial).

pdns/serialtweaker.cc
regression-tests.api/test_Zones.py

index 8475a0c6f125b44cc08caeb96d17c520c5967abe..06a036536bf073fe9f76e07b16d140e5e08b86ec 100644 (file)
@@ -47,8 +47,11 @@ uint32_t calculateEditSOA(uint32_t old_serial, const string& kind, const DNSName
 
     if(old_serial < inception_serial - 1) { /* less than <inceptionday>00 */
       return inception_serial; /* return <inceptionday>01   (skipping <inceptionday>00 as possible value) */
+    } else if (old_serial < inception_serial+1) {
+      /* "<inceptionday>00" and "<inceptionday>01" are reserved for inception increasing, so jump to "<inceptionday>02" */
+      return inception_serial+1;
     } else if(old_serial <= dont_increment_after) { /* >= <inceptionday>00 but <= <inceptionday+2>99 */
-      return (old_serial + 2); /* "<inceptionday>00" and "<inceptionday>01" are reserved for inception increasing, so increment sd.serial by two */
+      return old_serial + 1;
     }
   }
   else if(pdns_iequals(kind,"INCREMENT-WEEKS")) {
index e5ef9cf73406e3ac407dd69a232a10d588d1ca4d..ece4a0df23c2a36a609e2b6bc97e48ec85cab3c9 100644 (file)
@@ -148,6 +148,27 @@ class AuthZones(ApiTestCase, AuthZonesHelperMixin):
         soa_serial = get_first_rec(data, name, 'SOA')['content'].split(' ')[2]
         # These particular settings lead to the first serial set to YYYYMMDD01.
         self.assertEquals(soa_serial[-2:], '01')
+        rrset = {
+            'changetype': 'replace',
+            'name': name,
+            'type': 'A',
+            'ttl': 3600,
+            'records': [
+                {
+                    "content": "127.0.0.1",
+                    "disabled": False
+                }
+            ]
+        }
+        payload = {'rrsets': [rrset]}
+        self.session.patch(
+            self.url("/api/v1/servers/localhost/zones/" + data['id']),
+            data=json.dumps(payload),
+            headers={'content-type': 'application/json'})
+        r = self.session.get(self.url("/api/v1/servers/localhost/zones/" + data['id']))
+        data = r.json()
+        soa_serial = get_first_rec(data, name, 'SOA')['content'].split(' ')[2]
+        self.assertEquals(soa_serial[-2:], '02')
 
     def test_create_zone_with_records(self):
         name = unique_zone_name()