[PATCH net-next v3] netlink: Rightsize IFLA_AF_SPEC size calculation

2015-10-19 Thread Ronen Arad
size op in rtnl_af_ops. Bridge module already used filtering aware sizing for notifications. br_get_link_af_size_filtered() is consistent with the modified get_link_af_size op so it replaces br_get_link_af_size() in br_af_ops. br_get_link_af_size() becomes unused and thus removed. Signed-off-by:

[PATCH net-next v2] netlink: Trim skb to alloc size to avoid MSG_TRUNC

2015-10-15 Thread Ronen Arad
to allocated size in order to allow the user to avoid truncation with more reasonable buffer size. Signed-off-by: Ronen Arad --- net/netlink/af_netlink.c | 34 ++ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/net/netlink/af_netlink.c b/net/netl

[PATCH net-next v3] netlink: Rightsize IFLA_AF_SPEC size calculation

2015-10-14 Thread Ronen Arad
if_nlmsg_size() overestimates the minimum allocation size of netlink dump request (when called from rtnl_calcit()) or the size of the message (when called from rtnl_getlink()). This is because ext_filter_mask is not supported by rtnl_link_get_af_size() and rtnl_link_get_size(). The over-estimation

[PATCH net-next v2] netlink: Rightsize IFLA_AF_SPEC size calculation

2015-10-14 Thread Ronen Arad
This is a v2 of a 4-parts patch with same subject. Giving up on backward compatibility allows for much simplified single patch. if_nlmsg_size() overestimates the minimum allocation size of netlink dump request (when called from rtnl_calcit()) or the size of the message (when called from rtnl_getli

[PATCH net-next 4/4] bridge: Remove br_get_link_af_size

2015-10-13 Thread Ronen Arad
Unset get_link_af_size in br_af_ops. br_get_link_af_size() becomes unused and thus removed. Signed-off-by: Ronen Arad --- net/bridge/br_netlink.c | 20 1 file changed, 20 deletions(-) diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index d900881..204222d

[PATCH net-next 2/4] bridge: br_af_ops add br_get_link_af_size_filtered

2015-10-13 Thread Ronen Arad
ffect with rtnetlink change in the next patch of this set. Signed-off-by: Ronen Arad --- net/bridge/br_netlink.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index 94b4de8..d900881 100644 --- a/net/bridge/br_netlink.c

[PATCH net-next 1/4] rtnetlink: Add get_link_af_size_filtered to rtnl_af_ops

2015-10-13 Thread Ronen Arad
Signed-off-by: Ronen Arad --- include/net/rtnetlink.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h index aff6ceb..96df9bb 100644 --- a/include/net/rtnetlink.h +++ b/include/net/rtnetlink.h @@ -130,6 +130,8 @@ struct r

[PATCH net-next 3/4] rtnetlink: Prefer filtering-aware af sizing

2015-10-13 Thread Ronen Arad
Add ext_filter_mask arg to rtnl_link_get_af_size(). rtnl_link_get_af_size() will prefer filtering-aware af sizing when provided by an address family. It falls back to get_link_af_size for other families. Signed-off-by: Ronen Arad --- net/core/rtnetlink.c | 12 +--- 1 file changed, 9

[PATCH net-next 0/4] Rightsize IFLA_AF_SPEC size calculation

2015-10-13 Thread Ronen Arad
iltered op in struct rtnl_af_ops. Bridge module, which already used filtering aware sizing for notification, is enhanced to do the same for netlink dump requests. Ronen Arad (4): rtnetlink: Add get_link_af_size_filtered to rtnl_af_ops bridge: br_af_ops add br_get_link_af_size_filtered rtnetli

[PATCH] netlink: trim skb to exact size to avoid MSG_TRUNC

2015-10-12 Thread Ronen Arad
kb allocated when no interface has many VLANs configured. This patch applies the same logic to larger skbs which are allocated using the calculated min_dump_alloc size. Signed-off-by: Ronen Arad --- net/netlink/af_netlink.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/ne

[PATCH] rtnetlink: fix gcc -Wconversion warning

2015-10-09 Thread Ronen Arad
RTA_ALIGNTO is currently define as 4. It has to be 4U to prevent warning for RTA_ALIGN and RTA_DATA expansions when -Wconversion gcc option is enabled. This follows NLMSG_ALIGNTO definition in . Signed-off-by: Ronen Arad --- include/uapi/linux/rtnetlink.h | 2 +- 1 file changed, 1 insertion