Subject: Re: [PATCH net 1/2] rtnetlink: count IFLA_PARENT_DEV_{NAME,BUS_NAME} in if_nlmsg_size

From: Sabrina Dubroca <[email-masked]>
Date: Thu, 19 Mar 2026 10:31:16 +0100

2026-03-19, 08:59:47 +0200, Sergey Ryazanov wrote:
> On March 18, 2026 12:45:52 PM, Sabrina Dubroca <[email-masked]> wrote:
> >Commit 00e77ed8e64d ("rtnetlink: add IFLA_PARENT_[DEV|DEV_BUS]_NAME")
> >added those attributes to rtnl_fill_ifinfo, but forgot to extend
> >if_nlmsg_size.
> 
> Nice catch! Please find an implementation question below.
> 
> >Fixes: 00e77ed8e64d ("rtnetlink: add IFLA_PARENT_[DEV|DEV_BUS]_NAME")
> >Signed-off-by: Sabrina Dubroca <[email-masked]>
> >---
> > net/core/rtnetlink.c | 16 ++++++++++++++++
> > 1 file changed, 16 insertions(+)
> >
> >diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> >index dad4b1054955..a116362f5f32 100644
> >--- a/net/core/rtnetlink.c
> >+++ b/net/core/rtnetlink.c
> >@@ -1267,6 +1267,21 @@ static size_t rtnl_dpll_pin_size(const struct net_device *dev)
> > 	return size;
> > }
> > 
> >+static size_t rtnl_dev_parent_size(const struct net_device *dev)
> >+{
> >+	size_t size = 0;
> >+
> >+	/* IFLA_PARENT_DEV_NAME */
> >+	if (dev->dev.parent)
> >+		size += strlen(dev_name(dev->dev.parent)) + 1;
> 
> Shall we use nla_total_size() to account alignment?

Oops, thanks for catching my brainfart (it's not alignment but the
attribute header). I'll send a v2 later today.

-- 
Sabrina