]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
kxdpgun: make TRANSACTION_ID random but constant per program execution
authorDaniel Salzman <daniel.salzman@nic.cz>
Tue, 18 Aug 2020 18:11:26 +0000 (20:11 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Tue, 18 Aug 2020 18:11:26 +0000 (20:11 +0200)
src/utils/kxdpgun/main.c

index 52818eac1156d0fea0786c9be2f7ba14a8493cff..c77a0aa4afbad93df24929fcad889c8300b603e2 100644 (file)
@@ -43,7 +43,7 @@
 
 #define PROGRAM_NAME "kxdpgun"
 
-#define TRANSACTION_ID htobe16(0xbaf8) // entirely arbitrary magic constant to distinguish from other traffic
+uint16_t TRANSACTION_ID; // random constant to distinguish foreign replies
 
 volatile bool xdp_trigger = false;
 
@@ -625,6 +625,8 @@ int main(int argc, char *argv[])
                return EXIT_FAILURE;
        }
 
+       TRANSACTION_ID = time(NULL) % UINT16_MAX;
+
        thread_ctxs = calloc(ctx.n_threads, sizeof(*thread_ctxs));
        threads = calloc(ctx.n_threads, sizeof(*threads));
        if (thread_ctxs == NULL || threads == NULL) {