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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1516641978-24269-6-git-send-email-serhe.popovych@gmail.com>
Date:   Mon, 22 Jan 2018 19:26:15 +0200
From:   Serhey Popovych <serhe.popovych@...il.com>
To:     netdev@...r.kernel.org
Subject: [PATCH iproute2-next 5/8] ipneigh: Use get_addr_rta()

Setting ->family in @inet_prefix seems pointless:
inet_addr_match() does not consider it's value:
better is to force get_addr_rta() to use address
family from filter to ensure we get correct one.

Signed-off-by: Serhey Popovych <serhe.popovych@...il.com>
---
 ip/ipneigh.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/ip/ipneigh.c b/ip/ipneigh.c
index 11f280d..d9de935 100644
--- a/ip/ipneigh.c
+++ b/ip/ipneigh.c
@@ -234,14 +234,14 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
 
 	parse_rtattr(tb, NDA_MAX, NDA_RTA(r), n->nlmsg_len - NLMSG_LENGTH(sizeof(*r)));
 
-	if (tb[NDA_DST]) {
-		if (filter.pfx.family) {
-			inet_prefix dst = { .family = r->ndm_family };
+	if (filter.pfx.family && tb[NDA_DST]) {
+		struct rtattr *rta = tb[NDA_DST];
+		inet_prefix dst, *f_pfx = &filter.pfx;
 
-			memcpy(&dst.data, RTA_DATA(tb[NDA_DST]), RTA_PAYLOAD(tb[NDA_DST]));
-			if (inet_addr_match(&dst, &filter.pfx, filter.pfx.bitlen))
-				return 0;
-		}
+		if (get_addr_rta(&dst, rta, f_pfx->family))
+			return 0;
+		if (inet_addr_match(&dst, f_pfx, f_pfx->bitlen))
+			return 0;
 	}
 	if (filter.unused_only && tb[NDA_CACHEINFO]) {
 		struct nda_cacheinfo *ci = RTA_DATA(tb[NDA_CACHEINFO]);
-- 
1.7.10.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ