mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git
synced 2026-04-05 00:08:32 -04:00
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>
This commit is contained in:
@@ -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();
|
||||
@@ -1267,6 +1270,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 +1346,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))
|
||||
|
||||
Reference in New Issue
Block a user