public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] netkit: Don't emit scrub attribute for single device mode
@ 2026-04-10  7:23 Daniel Borkmann
  2026-04-10  7:43 ` Nikolay Aleksandrov
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Borkmann @ 2026-04-10  7:23 UTC (permalink / raw)
  To: netdev; +Cc: bpf, kuba, dw, pabeni, razor

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>
---
 drivers/net/netkit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/netkit.c b/drivers/net/netkit.c
index 5619209329d5..7b56a7ad7a49 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;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] netkit: Don't emit scrub attribute for single device mode
  2026-04-10  7:23 [PATCH net-next] netkit: Don't emit scrub attribute for single device mode Daniel Borkmann
@ 2026-04-10  7:43 ` Nikolay Aleksandrov
  0 siblings, 0 replies; 2+ messages in thread
From: Nikolay Aleksandrov @ 2026-04-10  7:43 UTC (permalink / raw)
  To: Daniel Borkmann, netdev; +Cc: bpf, kuba, dw, pabeni

On 4/10/26 10:23, Daniel Borkmann wrote:
> 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>
> ---
>  drivers/net/netkit.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/netkit.c b/drivers/net/netkit.c
> index 5619209329d5..7b56a7ad7a49 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;

Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-10  7:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-10  7:23 [PATCH net-next] netkit: Don't emit scrub attribute for single device mode Daniel Borkmann
2026-04-10  7:43 ` Nikolay Aleksandrov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox