lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230611105738.122706-1-gal@nvidia.com>
Date: Sun, 11 Jun 2023 13:57:38 +0300
From: Gal Pressman <gal@...dia.com>
To: "David S. Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>
CC: David Ahern <dsahern@...il.com>, Stephen Hemminger
	<stephen@...workplumber.org>, Michal Kubecek <mkubecek@...e.cz>,
	<netdev@...r.kernel.org>, Edwin Peer <edwin.peer@...adcom.com>, Edwin Peer
	<espeer@...il.com>, Gal Pressman <gal@...dia.com>
Subject: [PATCH iproute2-next] iplink: filter stats using RTEXT_FILTER_SKIP_STATS

From: Edwin Peer <edwin.peer@...adcom.com>

Don't request statistics we do not intend to render. This avoids the
possibility of a truncated IFLA_VFINFO_LIST when statistics are not
requested as well as the fetching of unnecessary data.

Signed-off-by: Edwin Peer <edwin.peer@...adcom.com>
Cc: Edwin Peer <espeer@...il.com>
Signed-off-by: Gal Pressman <gal@...dia.com>
---
Userspace side for kernel submission:
https://lore.kernel.org/all/20230611105108.122586-1-gal@nvidia.com/

It is only a partial "fix", but increases the number of VFs presented
before the truncation occurs.
---
 ip/ipaddress.c | 6 +++++-
 ip/iplink.c    | 3 +++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 361e6875b671..8197709d172e 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -2031,9 +2031,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;
 
diff --git a/ip/iplink.c b/ip/iplink.c
index 690636b65190..6c5d13d53a84 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -1166,6 +1166,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)
-- 
2.39.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ