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: <20231211140732.11475-12-bpoirier@nvidia.com>
Date: Mon, 11 Dec 2023 09:07:23 -0500
From: Benjamin Poirier <bpoirier@...dia.com>
To: netdev@...r.kernel.org
Cc: Petr Machata <petrm@...dia.com>,
	Roopa Prabhu <roopa@...dia.com>
Subject: [PATCH iproute2-next 11/20] bridge: vni: Reverse the logic in print_vnifilter_rtm()

print_vnifilter_rtm() is structured similarly to print_vlan_tunnel_info()
except that in the former, the open_vni_port() call is guarded by a "if
(first)" check whereas in the latter, the open_vlan_port() call is guarded
by a "if (!opened)" check.

Reverse the logic in one of the functions to have the same structure in
both. Since the calls being guarded are "open_...()", "close_...()", use
the "opened" logic structure.

Reviewed-by: Petr Machata <petrm@...dia.com>
Tested-by: Petr Machata <petrm@...dia.com>
Signed-off-by: Benjamin Poirier <bpoirier@...dia.com>
---
 bridge/vni.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/bridge/vni.c b/bridge/vni.c
index ca5d2e43..b597a916 100644
--- a/bridge/vni.c
+++ b/bridge/vni.c
@@ -296,7 +296,7 @@ int print_vnifilter_rtm(struct nlmsghdr *n, void *arg)
 {
 	struct tunnel_msg *tmsg = NLMSG_DATA(n);
 	int len = n->nlmsg_len;
-	bool first = true;
+	bool opened = false;
 	struct rtattr *t;
 	FILE *fp = arg;
 	int rem;
@@ -332,9 +332,10 @@ int print_vnifilter_rtm(struct nlmsghdr *n, void *arg)
 
 		if (rta_type != VXLAN_VNIFILTER_ENTRY)
 			continue;
-		if (first) {
+
+		if (!opened) {
 			open_vni_port(tmsg->ifindex, "%s");
-			first = false;
+			opened = true;
 		} else {
 			print_string(PRINT_FP, NULL, "%-" __stringify(IFNAMSIZ) "s  ", "");
 		}
@@ -342,7 +343,7 @@ int print_vnifilter_rtm(struct nlmsghdr *n, void *arg)
 		print_vni(t, tmsg->ifindex);
 	}
 
-	if (!first)
+	if (opened)
 		close_vni_port();
 
 	print_string(PRINT_FP, NULL, "%s", _SL_);
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ