]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
kxdpgun: mute log 'libbpf: can't get link by id (5535): Resource temporarily unavailable'
authorDaniel Salzman <daniel.salzman@nic.cz>
Wed, 13 Jul 2022 13:18:36 +0000 (15:18 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Sun, 24 Jul 2022 17:34:26 +0000 (19:34 +0200)
src/utils/kxdpgun/main.c

index 6974c598e21125eb2f624893faef7fa9d629da13..1a33bc80e85179404c19a6456557483aa105ee49 100644 (file)
@@ -473,8 +473,14 @@ void *xdp_gun_thread(void *_ctx)
 
        knot_xdp_load_bpf_t mode = (ctx->thread_id == 0 ?
                                    KNOT_XDP_LOAD_BPF_ALWAYS : KNOT_XDP_LOAD_BPF_NEVER);
+       /*
+        * This mutex prevents libbpf from logging:
+        * 'libbpf: can't get link by id (5535): Resource temporarily unavailable'
+       */
+       pthread_mutex_lock(&global_stats.mutex);
        int ret = knot_xdp_init(&xsk, ctx->dev, ctx->thread_id, ctx->flags,
                                ctx->listen_port, ctx->listen_port, mode);
+       pthread_mutex_unlock(&global_stats.mutex);
        if (ret != KNOT_EOK) {
                ERR2("failed to initialize XDP socket#%u (%s)\n",
                     ctx->thread_id, knot_strerror(ret));