Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'rtnetlink-add-missing-attributes-in-if_nlmsg_size'

Sabrina Dubroca says:

====================
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().
====================

Link: https://patch.msgid.link/cover.1773919462.git.sd@queasysnail.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+22 -3
+22 -3
net/core/rtnetlink.c
··· 707 707 goto out; 708 708 709 709 ops = master_dev->rtnl_link_ops; 710 - if (!ops || !ops->get_slave_size) 710 + if (!ops) 711 + goto out; 712 + size += nla_total_size(strlen(ops->kind) + 1); /* IFLA_INFO_SLAVE_KIND */ 713 + if (!ops->get_slave_size) 711 714 goto out; 712 715 /* IFLA_INFO_SLAVE_DATA + nested data */ 713 - size = nla_total_size(sizeof(struct nlattr)) + 714 - ops->get_slave_size(master_dev, dev); 716 + size += nla_total_size(sizeof(struct nlattr)) + 717 + ops->get_slave_size(master_dev, dev); 715 718 716 719 out: 717 720 rcu_read_unlock(); ··· 1270 1267 return size; 1271 1268 } 1272 1269 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 + 1273 1285 static noinline size_t if_nlmsg_size(const struct net_device *dev, 1274 1286 u32 ext_filter_mask) 1275 1287 { ··· 1346 1328 + nla_total_size(8) /* IFLA_MAX_PACING_OFFLOAD_HORIZON */ 1347 1329 + nla_total_size(2) /* IFLA_HEADROOM */ 1348 1330 + nla_total_size(2) /* IFLA_TAILROOM */ 1331 + + rtnl_dev_parent_size(dev) 1349 1332 + 0; 1350 1333 1351 1334 if (!(ext_filter_mask & RTEXT_FILTER_SKIP_STATS))