lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4c0389de-1e74-46f8-9ce8-4927241fd35c@orange.com>
Date: Wed, 11 Jun 2025 14:08:07 +0200
From: Alexandre Ferrieux <alexandre.ferrieux@...il.com>
To: Daniel Borkmann <daniel@...earbox.net>
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>,
 Nicolas Dichtel <nicolas.dichtel@...nd.com>
Subject: [BUG iproute2] Netkit unusable in batch mode

Hi Daniel,

Playing around with netkit to circumvent veth performance issues, I stumbled
upon a strange thing in iplink_netkit.c : the presence of three static variables
which tend to wreak havoc in case of multiple netlink commands in batch mode (ip
-b) : "seen_mode", "seen_peer", and "data".

As a consequence, the following simple batch sequence systematically fails:

    # ip -b - <<EOF
    link add a1 type netkit peer a2
    link add b1 type netkit peer b2
    EOF
    *    Error: duplicate "peer": "b2" is the second value.*

While the patch below solves the problem, I wonder: why in the first place are
these three locals declared static ? Is there a scenario where
netkit_parse_opt() is called several times in a single command, but in a
stateful manner ?

Thanks for any clarification

-Alex

-----

diff --git a/ip/iplink_netkit.c b/ip/iplink_netkit.c
index 818da119..de1681b9 100644
--- a/ip/iplink_netkit.c
+++ b/ip/iplink_netkit.c
@@ -48,8 +48,8 @@ static int netkit_parse_opt(struct link_util *lu, int argc,
char **argv,
 {
        __u32 ifi_flags, ifi_change, ifi_index;
        struct ifinfomsg *ifm, *peer_ifm;
-       static bool seen_mode, seen_peer;
-       static struct rtattr *data;
+       bool seen_mode=false, seen_peer=false;
+       struct rtattr *data=NULL;
        int err;

        ifm = NLMSG_DATA(n);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ