]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
ctl: add new "zone-backup" filters "+quic" and "+noquic"
authorDavid Vašek <david.vasek@nic.cz>
Fri, 19 May 2023 09:48:25 +0000 (11:48 +0200)
committerDavid Vašek <david.vasek@nic.cz>
Mon, 12 Jun 2023 09:11:24 +0000 (11:11 +0200)
src/knot/ctl/commands.c
src/knot/ctl/commands.h
src/knot/zone/backup.h
src/knot/zone/backup_dir.c
src/utils/knotc/commands.c

index 319281be397e330c0cd335f2fecc8cd1876bf42f..b991707578f2d28679ce4873531b14bbc3fb1096 100644 (file)
@@ -516,7 +516,8 @@ static int init_backup(ctl_args_t *args, bool restore_mode)
        }
 
        // Evaluate filters (and possibly fail) before writing to the filesystem.
-       bool filter_zonefile, filter_journal, filter_timers, filter_kaspdb, filter_catalog;
+       bool filter_zonefile, filter_journal, filter_timers, filter_kaspdb,
+            filter_catalog, filter_quic;
 
        // The default filter values are set just in this paragraph.
        if (!(eval_opposite_filters(args, &filter_zonefile, true,
@@ -528,7 +529,9 @@ static int init_backup(ctl_args_t *args, bool restore_mode)
            eval_opposite_filters(args, &filter_kaspdb, true,
                                  CTL_FILTER_BACKUP_KASPDB, CTL_FILTER_BACKUP_NOKASPDB) &&
            eval_opposite_filters(args, &filter_catalog, true,
-                                 CTL_FILTER_BACKUP_CATALOG, CTL_FILTER_BACKUP_NOCATALOG))) {
+                                 CTL_FILTER_BACKUP_CATALOG, CTL_FILTER_BACKUP_NOCATALOG) &&
+           eval_opposite_filters(args, &filter_quic, false,
+                                 CTL_FILTER_BACKUP_QUIC, CTL_FILTER_BACKUP_NOQUIC))) {
                return KNOT_EXPARAM;
        }
 
@@ -556,6 +559,7 @@ static int init_backup(ctl_args_t *args, bool restore_mode)
        ctx->backup_timers = filter_timers;
        ctx->backup_kaspdb = filter_kaspdb;
        ctx->backup_catalog = filter_catalog;
+       ctx->backup_quic = filter_quic;
 
        zone_backups_add(&args->server->backup_ctxs, ctx);
 
index ab7984e3976b2b4328e878e6ff7ecb299663f6e2..cb13f99b5eafb4618f75cfef9cc9b43b59969549 100644 (file)
@@ -1,4 +1,4 @@
-/*  Copyright (C) 2022 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/*  Copyright (C) 2023 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -61,6 +61,8 @@
 #define CTL_FILTER_BACKUP_NOKASPDB     'K'
 #define CTL_FILTER_BACKUP_CATALOG      'c'
 #define CTL_FILTER_BACKUP_NOCATALOG    'C'
+#define CTL_FILTER_BACKUP_QUIC         'q'
+#define CTL_FILTER_BACKUP_NOQUIC       'Q'
 
 #define STATUS_EMPTY                   "-"
 
index 2b4253876f241f8d8e744ad7ef03cdc45199ab7b..35088b3e94b7b0a6b2b157283751ccdd0eb4a314 100644 (file)
@@ -38,6 +38,7 @@ typedef struct zone_backup_ctx {
        bool backup_timers;                 // if true, also backup timers
        bool backup_kaspdb;                 // if true, also backup KASP database
        bool backup_catalog;                // if true, also backup zone catalog
+       bool backup_quic;                   // if true, also backup QUIC server key and certificate
        bool backup_global;                 // perform global backup for all zones
        ssize_t readers;                    // when decremented to 0, all zones done, free this context
        pthread_mutex_t readers_mutex;      // mutex covering readers counter
index 6cb6c1ff35b92a2da8456626cfdd2dde070e18c0..efc365e1a3245c9ddeb20b55228389780a1c4e56 100644 (file)
@@ -90,7 +90,7 @@ static int make_label_file(zone_backup_ctx_t *ctx)
                      "finished_time: %s\n"
                      "knot_version: %s\n"
                      "parameters: +%szonefile +%sjournal +%stimers +%skaspdb +%scatalog "
-                         "+backupdir %s\n"
+                         "+%squic +backupdir %s\n"
                      "zone_count: %d\n",
                      label_file_head,
                      ctx->backup_format, ident, started_time, finished_time, PACKAGE_VERSION,
@@ -99,6 +99,7 @@ static int make_label_file(zone_backup_ctx_t *ctx)
                      ctx->backup_timers ? "" : "no",
                      ctx->backup_kaspdb ? "" : "no",
                      ctx->backup_catalog ? "" : "no",
+                     ctx->backup_quic ? "" : "no",
                      ctx->backup_dir,
                      ctx->zone_count);
 
index abfb12be0acf2e7a56b5ab5f11007e1dc775b4ea..19e9d7cb89427e1760638f4c139ecc73b43ee4aa 100644 (file)
@@ -681,7 +681,7 @@ static int cmd_zone_ctl(cmd_args_t *args)
        return ctl_receive(args);
 }
 
-#define MAX_FILTERS 12
+#define MAX_FILTERS 14
 
 typedef struct {
        const char *name;
@@ -705,6 +705,8 @@ const filter_desc_t zone_backup_filters[MAX_FILTERS] = {
        { "+nokaspdb",    CTL_FILTER_BACKUP_NOKASPDB,   false },
        { "+catalog",     CTL_FILTER_BACKUP_CATALOG,    false },
        { "+nocatalog",   CTL_FILTER_BACKUP_NOCATALOG,  false },
+       { "+quic",        CTL_FILTER_BACKUP_QUIC,       false },
+       { "+noquic",      CTL_FILTER_BACKUP_NOQUIC,     false },
 };
 
 const filter_desc_t zone_status_filters[MAX_FILTERS] = {