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: <20180929175931.18448-8-dsahern@kernel.org>
Date:   Sat, 29 Sep 2018 10:59:27 -0700
From:   David Ahern <dsahern@...nel.org>
To:     netdev@...r.kernel.org
Cc:     stephen@...workplumber.org, christian@...uner.io,
        David Ahern <dsahern@...il.com>
Subject: [PATCH iproute2-next 07/11] libnetlink: Convert GETNEIGH dumps to use rtnl_neighdump_req

From: David Ahern <dsahern@...il.com>

Add rtnl_neighdump_req for neighbor dumps using the proper ndmsg
as the header. Convert existing rtnl_wilddump_request for RTM_GETNEIGH
to use it.

Signed-off-by: David Ahern <dsahern@...il.com>
---
 include/libnetlink.h |  2 ++
 lib/libnetlink.c     | 16 ++++++++++++++++
 misc/arpd.c          |  2 +-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/include/libnetlink.h b/include/libnetlink.h
index 5f6bbe55fe4a..e22ccbb82ce2 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -55,6 +55,8 @@ int rtnl_routedump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
 int rtnl_ruledump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
+int rtnl_neighdump_req(struct rtnl_handle *rth, int family)
+	__attribute__((warn_unused_result));
 int rtnl_mdbdump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
 int rtnl_netconfdump_req(struct rtnl_handle *rth, int family)
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index 89e4d6a2a662..fd0f95a24194 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -266,6 +266,22 @@ int rtnl_ruledump_req(struct rtnl_handle *rth, int family)
 	return send(rth->fd, &req, sizeof(req), 0);
 }
 
+int rtnl_neighdump_req(struct rtnl_handle *rth, int family)
+{
+	struct {
+		struct nlmsghdr nlh;
+		struct ndmsg ndm;
+	} req = {
+		.nlh.nlmsg_len = sizeof(req),
+		.nlh.nlmsg_type = RTM_GETNEIGH,
+		.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
+		.nlh.nlmsg_seq = rth->dump = ++rth->seq,
+		.ndm.ndm_family = family,
+	};
+
+	return send(rth->fd, &req, sizeof(req), 0);
+}
+
 int rtnl_mdbdump_req(struct rtnl_handle *rth, int family)
 {
 	struct {
diff --git a/misc/arpd.c b/misc/arpd.c
index 67d86b67957b..ce7c09978c2b 100644
--- a/misc/arpd.c
+++ b/misc/arpd.c
@@ -424,7 +424,7 @@ static int do_one_request(struct nlmsghdr *n)
 
 static void load_initial_table(void)
 {
-	if (rtnl_wilddump_request(&rth, AF_INET, RTM_GETNEIGH) < 0) {
+	if (rtnl_neighdump_req(&rth, AF_INET) < 0) {
 		perror("dump request failed");
 		exit(1);
 	}
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ