]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
zone: don't ignore manually triggered zone flush
authorDaniel Salzman <daniel.salzman@nic.cz>
Thu, 9 Jun 2022 12:59:45 +0000 (14:59 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Thu, 9 Jun 2022 12:59:45 +0000 (14:59 +0200)
src/knot/ctl/commands.c
src/knot/zone/zone.c
src/knot/zone/zone.h

index ebc59d82fd9dff2d889218a620c2883a67bdbeac..12ee6b34ad6858261994bb16908c968c4d7de0cb 100644 (file)
@@ -464,6 +464,7 @@ static int zone_flush(zone_t *zone, ctl_args_t *args)
                return ret;
        }
 
+       zone_set_flag(zone, ZONE_USER_FLUSH);
        if (ctl_has_flag(args->data[KNOT_CTL_IDX_FLAGS], CTL_FLAG_FORCE)) {
                zone_set_flag(zone, ZONE_FORCE_FLUSH);
        }
index e2feff8a4f9fb13da7dd404718b8a65af543f797..8314a246b8cda93ccc55f4de91ab1c0f52f18f60 100644 (file)
@@ -70,6 +70,7 @@ static int flush_journal(conf_t *conf, zone_t *zone, bool allow_empty_zone, bool
        zone_journal_t j = zone_journal(zone);
 
        bool force = zone_get_flag(zone, ZONE_FORCE_FLUSH, true);
+       bool user_flush = zone_get_flag(zone, ZONE_USER_FLUSH, true);
 
        conf_val_t val = conf_zone_get(conf, C_ZONEFILE_SYNC, zone->name);
        int64_t sync_timeout = conf_int(&val);
@@ -95,7 +96,8 @@ static int flush_journal(conf_t *conf, zone_t *zone, bool allow_empty_zone, bool
        /* Check for updated zone. */
        zone_contents_t *contents = zone->contents;
        uint32_t serial_to = zone_contents_serial(contents);
-       if (!force && zone->zonefile.exists && zone->zonefile.serial == serial_to &&
+       if (!force && !user_flush &&
+           zone->zonefile.exists && zone->zonefile.serial == serial_to &&
            !zone->zonefile.retransfer && !zone->zonefile.resigned) {
                ret = KNOT_EOK; /* No differences. */
                goto flush_journal_replan;
index c0e082ed283ffabdedbad9e8bd05586aa47afd06..9f2ee3b6310ba1140301901c0864ee4ffce403e4 100644 (file)
@@ -47,6 +47,7 @@ typedef enum {
        ZONE_IS_CATALOG     = 1 << 5, /*!< This is a catalog. */
        ZONE_IS_CAT_MEMBER  = 1 << 6, /*!< This zone exists according to a catalog. */
        ZONE_XFR_FROZEN     = 1 << 7, /*!< Outgoing AXFR/IXFR temporarily disabled. */
+       ZONE_USER_FLUSH     = 1 << 8, /*!< User-triggered flush. */
 } zone_flag_t;
 
 /*!