From 4b7694014a47c3f6e3a158297aea6bb8e43ff246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Va=C5=A1ek?= <david.vasek@nic.cz> Date: Wed, 30 Mar 2022 17:24:37 +0200 Subject: [PATCH] catalog: document and enforce 'unixtime' serial-policy for generated catalog zones --- doc/man/knot.conf.5in | 4 +++- doc/reference.rst | 4 +++- src/knot/conf/tools.c | 8 ++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/man/knot.conf.5in b/doc/man/knot.conf.5in index 853aa8c6e7..89ba9a8e14 100644 --- a/doc/man/knot.conf.5in +++ b/doc/man/knot.conf.5in @@ -2110,10 +2110,12 @@ frequent updates), the serial is incremented instead. To avoid user confusion, use \fBdateserial\fP only if you expect at most 100 updates per day per zone and \fBunixtime\fP only if you expect at most one update per second per zone. +.sp +Generated catalog zones use \fBunixtime\fP only. .UNINDENT .UNINDENT .sp -\fIDefault:\fP increment +\fIDefault:\fP increment (unixtime for generated catalog zones) .SS refresh\-min\-interval .sp Forced minimum zone refresh interval (in seconds) to avoid flooding primary server. diff --git a/doc/reference.rst b/doc/reference.rst index d6b1e28a82..8685ecc5b8 100644 --- a/doc/reference.rst +++ b/doc/reference.rst @@ -2288,7 +2288,9 @@ Possible values: 100 updates per day per zone and ``unixtime`` only if you expect at most one update per second per zone. -*Default:* increment + Generated catalog zones use ``unixtime`` only. + +*Default:* increment (unixtime for generated catalog zones) .. _zone_refresh-min-interval: diff --git a/src/knot/conf/tools.c b/src/knot/conf/tools.c index 2096e1a08f..05846115b5 100644 --- a/src/knot/conf/tools.c +++ b/src/knot/conf/tools.c @@ -824,6 +824,8 @@ int check_zone( C_CATALOG_TPL, yp_dname(args->id)); conf_val_t catalog_zone = conf_zone_get_txn(args->extra->conf, args->extra->txn, C_CATALOG_ZONE, yp_dname(args->id)); + conf_val_t catalog_serial = conf_zone_get_txn(args->extra->conf, args->extra->txn, + C_SERIAL_POLICY, yp_dname(args->id)); if ((bool)(conf_opt(&catalog_role) == CATALOG_ROLE_INTERPRET) != (bool)(catalog_tpl.code == KNOT_EOK)) { args->err_str = "'catalog-role' must correspond to configured 'catalog-template'"; @@ -834,6 +836,12 @@ int check_zone( args->err_str = "'catalog-role' must correspond to configured 'catalog-zone'"; return KNOT_EINVAL; } + if (conf_opt(&catalog_role) == CATALOG_ROLE_GENERATE && + conf_opt(&catalog_serial) != SERIAL_POLICY_UNIXTIME && // Default doesn't harm. + catalog_serial.code == KNOT_EOK) { + args->err_str = "'serial-policy' must be 'unixtime' for generated catalog zones"; + return KNOT_EINVAL; + } return KNOT_EOK; } -- GitLab