From: Daniel Borkmann Date: Fri, 10 Apr 2026 07:23:34 +0000 (+0200) Subject: netkit: Don't emit scrub attribute for single device mode X-Git-Tag: v7.1-rc1~173^2~33 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e530b484b70552d6222e2327e311f364724ce616;p=thirdparty%2Fkernel%2Flinux.git netkit: Don't emit scrub attribute for single device mode 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 Reviewed-by: Nikolay Aleksandrov Link: https://patch.msgid.link/20260410072334.548232-1-daniel@iogearbox.net Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/netkit.c b/drivers/net/netkit.c index 5619209329d56..7b56a7ad7a496 100644 --- a/drivers/net/netkit.c +++ b/drivers/net/netkit.c @@ -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;