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-next>] [day] [month] [year] [list]
Message-Id: <20210331022234.52977-1-xuchunmei@linux.alibaba.com>
Date:   Wed, 31 Mar 2021 10:22:34 +0800
From:   Chunmei Xu <xuchunmei@...ux.alibaba.com>
To:     idosch@...sch.org, dsahern@...il.com
Cc:     netdev@...r.kernel.org
Subject: [PATCH] ip-nexthop: support flush by id

add id to struct filter to record the 'id',
filter id only when id is set, otherwise flush all. 

Signed-off-by: Chunmei Xu <xuchunmei@...ux.alibaba.com>
---
 ip/ipnexthop.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/ip/ipnexthop.c b/ip/ipnexthop.c
index 22c66491..fd759140 100644
--- a/ip/ipnexthop.c
+++ b/ip/ipnexthop.c
@@ -21,6 +21,7 @@ static struct {
 	unsigned int master;
 	unsigned int proto;
 	unsigned int fdb;
+	unsigned int id;
 } filter;
 
 enum {
@@ -124,6 +125,9 @@ static int flush_nexthop(struct nlmsghdr *nlh, void *arg)
 	if (tb[NHA_ID])
 		id = rta_getattr_u32(tb[NHA_ID]);
 
+	if (filter.id && filter.id != id)
+		return 0;
+
 	if (id && !delete_nexthop(id))
 		filter.flushed++;
 
@@ -491,7 +495,10 @@ static int ipnh_list_flush(int argc, char **argv, int action)
 			NEXT_ARG();
 			if (get_unsigned(&id, *argv, 0))
 				invarg("invalid id value", *argv);
-			return ipnh_get_id(id);
+			if (action == IPNH_FLUSH)
+				filter.id = id;
+			else
+				return ipnh_get_id(id);
 		} else if (!matches(*argv, "protocol")) {
 			__u32 proto;
 
-- 
2.27.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ