rtnetlink: add missing attributes in if_nlmsg_size
Subsystems (2)
v2 cover rtnetlink: add missing attributes in if_nlmsg_size
Once again we have some attributes added by rtnl_fill_ifinfo() that aren't counted in if_nlmsg_size().
v2: add missing nla_total_size in patch 1, spotted by Sergey Ryazanov
patch 2 unchanged, keep Jiri Pirko's Reviewed-by
Sabrina Dubroca (2):
rtnetlink: count IFLA_PARENT_DEV_{NAME,BUS_NAME} in if_nlmsg_size
rtnetlink: count IFLA_INFO_SLAVE_KIND in if_nlmsg_size
net/core/rtnetlink.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
Signature · 1 line
2.51.2
PATCH v2 1/2 rtnetlink: count IFLA_PARENT_DEV_{NAME,BUS_NAME} in if_nlmsg_size
Commit 00e77ed8e64d ("rtnetlink: add IFLA_PARENT_[DEV|DEV_BUS]_NAME") added those attributes to rtnl_fill_ifinfo, but forgot to extend if_nlmsg_size.
--- net/core/rtnetlink.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
v2: add nla_total_size, spotted by Sergey Ryazanov
fix Loic Poulain's email address in the CC list
net/core/rtnetlink.c +16 -0
@@ -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 +=nla_total_size (strlen (dev_name (dev->dev.parent)) +1 ); + +/* IFLA_PARENT_DEV_BUS_NAME */ +if (dev->dev.parent && dev->dev.parent->bus) + size +=nla_total_size (strlen (dev->dev.parent->bus->name) +1 ); + +return size; +} + static noinline size_t if_nlmsg_size(const struct net_device *dev,u32 ext_filter_mask) {
@@ -1328,6 +1343,7 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev, +nla_total_size (8 )/* IFLA_MAX_PACING_OFFLOAD_HORIZON */ +nla_total_size (2 )/* IFLA_HEADROOM */ +nla_total_size (2 )/* IFLA_TAILROOM */ + +rtnl_dev_parent_size (dev) +0 ;if (!(ext_filter_mask &RTEXT_FILTER_SKIP_STATS ))
Signature · 1 line
2.51.2
Re: [PATCH net v2 1/2] rtnetlink: count IFLA_PARENT_DEV_{NAME,BUS_NAME} in if_nlmsg_size
Quoted 6 lines · Sabrina Dubroca
Commit
00e77ed8e64d("rtnetlink: add IFLA_PARENT_[DEV|DEV_BUS]_NAME") added those attributes tortnl_fill_ifinfo, but forgot to extendif_nlmsg_size.Fixes 00e77ed8e64d ("rtnetlink: add IFLA_PARENT_[DEV|DEV_BUS]_NAME")Signed-off-by Sabrina Dubroca <[email protected]>
PATCH v2 2/2 rtnetlink: count IFLA_INFO_SLAVE_KIND in if_nlmsg_size
In reply to Sabrina Dubrocartnl_link_get_slave_info_data_size counts IFLA_INFO_SLAVE_DATA, but rtnl_link_slave_info_fill adds both IFLA_INFO_SLAVE_DATA and IFLA_INFO_SLAVE_KIND.
--- net/core/rtnetlink.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
v2: unchanged, keep Reviewed-by from v1
net/core/rtnetlink.c +6 -3
@@ -707,11 +707,14 @@ static size_t rtnl_link_get_slave_info_data_size(const struct net_device *dev) goto out; ops = master_dev->rtnl_link_ops; -if (!ops || !ops->get_slave_size) +if (!ops) + goto out; + size +=nla_total_size (strlen (ops->kind) +1 );/* IFLA_INFO_SLAVE_KIND */ +if (!ops->get_slave_size) goto out;/* IFLA_INFO_SLAVE_DATA + nested data */ - size =nla_total_size (sizeof (struct nlattr )) + - ops->get_slave_size (master_dev, dev); + size +=nla_total_size (sizeof (struct nlattr )) + + ops->get_slave_size (master_dev, dev); out:rcu_read_unlock ();
Signature · 1 line
2.51.2
This series was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 11 lines · On Fri, 20 Mar 2026 00:02:51 +0100 you wrote:
Once again we have some attributes added by
rtnl_fill_ifinfo()that aren't counted inif_nlmsg_size().v2: add missing
nla_total_sizein patch 1, spotted by Sergey Ryazanov
patch 2 unchanged, keep Jiri Pirko's Reviewed-bySabrina Dubroca (2):
rtnetlink: count IFLA_PARENT_DEV_{NAME,BUS_NAME} inif_nlmsg_size
rtnetlink: countIFLA_INFO_SLAVE_KINDinif_nlmsg_size[...]
Here is the summary with links:
- [net,v2,1/2] rtnetlink: count IFLA_PARENT_DEV_{NAME,BUS_NAME} in if_nlmsg_size
https://git.kernel.org/netdev/net/c/52501989c762 - [net,v2,2/2] rtnetlink: count IFLA_INFO_SLAVE_KIND in if_nlmsg_size https://git.kernel.org/netdev/net/c/ee00a12593ff
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html