]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
netkit: Don't emit scrub attribute for single device mode
authorDaniel Borkmann <daniel@iogearbox.net>
Fri, 10 Apr 2026 07:23:34 +0000 (09:23 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sun, 12 Apr 2026 16:43:10 +0000 (09:43 -0700)
When userspace reads a single mode netkit device via RTM_GETLINK,
it receives IFLA_NETKIT_SCRUB=NETKIT_SCRUB_DEFAULT attribute from
netkit_fill_info(). If that attribute is echoed back to recreate
the device, the seen_scrub presence check in netkit_new_link()
causes creation to fail with -EOPNOTSUPP. Since it has no meaning
for single devices at this point, just don't dump it.

Fixes: 481038960538 ("netkit: Add single device mode for netkit")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Link: https://patch.msgid.link/20260410072334.548232-1-daniel@iogearbox.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/netkit.c

index 5619209329d56d02f30097a42b61a6e82d4f4b86..7b56a7ad7a496fbce771a9ae643e6ec9dc50734c 100644 (file)
@@ -1214,7 +1214,8 @@ static int netkit_fill_info(struct sk_buff *skb, const struct net_device *dev)
                return -EMSGSIZE;
        if (nla_put_u32(skb, IFLA_NETKIT_MODE, nk->mode))
                return -EMSGSIZE;
-       if (nla_put_u32(skb, IFLA_NETKIT_SCRUB, nk->scrub))
+       if (nk->pair == NETKIT_DEVICE_PAIR &&
+           nla_put_u32(skb, IFLA_NETKIT_SCRUB, nk->scrub))
                return -EMSGSIZE;
        if (nla_put_u16(skb, IFLA_NETKIT_HEADROOM, dev->needed_headroom))
                return -EMSGSIZE;