Skip to content

Commit 5250198

Browse files
qsnkuba-moo
authored andcommitted
rtnetlink: count IFLA_PARENT_DEV_{NAME,BUS_NAME} in if_nlmsg_size
Commit 00e77ed ("rtnetlink: add IFLA_PARENT_[DEV|DEV_BUS]_NAME") added those attributes to rtnl_fill_ifinfo, but forgot to extend if_nlmsg_size. Fixes: 00e77ed ("rtnetlink: add IFLA_PARENT_[DEV|DEV_BUS]_NAME") Signed-off-by: Sabrina Dubroca <[email protected]> Link: https://patch.msgid.link/0b849da95562af45487080528d60f578636aba5c.1773919462.git.sd@queasysnail.net Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 24dd586 commit 5250198

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

net/core/rtnetlink.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,21 @@ static size_t rtnl_dpll_pin_size(const struct net_device *dev)
12671267
return size;
12681268
}
12691269

1270+
static size_t rtnl_dev_parent_size(const struct net_device *dev)
1271+
{
1272+
size_t size = 0;
1273+
1274+
/* IFLA_PARENT_DEV_NAME */
1275+
if (dev->dev.parent)
1276+
size += nla_total_size(strlen(dev_name(dev->dev.parent)) + 1);
1277+
1278+
/* IFLA_PARENT_DEV_BUS_NAME */
1279+
if (dev->dev.parent && dev->dev.parent->bus)
1280+
size += nla_total_size(strlen(dev->dev.parent->bus->name) + 1);
1281+
1282+
return size;
1283+
}
1284+
12701285
static noinline size_t if_nlmsg_size(const struct net_device *dev,
12711286
u32 ext_filter_mask)
12721287
{
@@ -1328,6 +1343,7 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev,
13281343
+ nla_total_size(8) /* IFLA_MAX_PACING_OFFLOAD_HORIZON */
13291344
+ nla_total_size(2) /* IFLA_HEADROOM */
13301345
+ nla_total_size(2) /* IFLA_TAILROOM */
1346+
+ rtnl_dev_parent_size(dev)
13311347
+ 0;
13321348

13331349
if (!(ext_filter_mask & RTEXT_FILTER_SKIP_STATS))

0 commit comments

Comments
 (0)