@@ -1882,9 +1882,13 @@ static int ipaddr_flush(void)
static int iplink_filter_req(struct nlmsghdr *nlh, int reqlen)
{
+ __u32 filt_mask;
int err;
- err = addattr32(nlh, reqlen, IFLA_EXT_MASK, RTEXT_FILTER_VF);
+ filt_mask = RTEXT_FILTER_VF;
+ if (!show_stats)
+ filt_mask |= RTEXT_FILTER_SKIP_STATS;
+ err = addattr32(nlh, reqlen, IFLA_EXT_MASK, filt_mask);
if (err)
return err;
@@ -1116,6 +1116,9 @@ int iplink_get(char *name, __u32 filt_mask)
!check_ifname(name) ? IFLA_IFNAME : IFLA_ALT_IFNAME,
name, strlen(name) + 1);
}
+
+ if (!show_stats)
+ filt_mask |= RTEXT_FILTER_SKIP_STATS;
addattr32(&req.n, sizeof(req), IFLA_EXT_MASK, filt_mask);
if (rtnl_talk(&rth, &req.n, &answer) < 0)
Don't request statistics we do not intend to render. This is a step towards avoiding a truncated IFLA_VFINFO_LIST. It also avoids fetching unnecessary data, reducing netlink traffic. Signed-off-by: Edwin Peer <edwin.peer@broadcom.com> --- ip/ipaddress.c | 6 +++++- ip/iplink.c | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-)