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]
Date:	Fri, 10 Dec 2010 16:59:50 +0200
From:	Octavian Purdila <opurdila@...acom.com>
To:	netdev@...r.kernel.org
Cc:	Lucian Adrian Grijincu <lucian.grijincu@...il.com>,
	Vlad Dogaru <ddvlad@...edu.org>,
	Octavian Purdila <opurdila@...acom.com>
Subject: [PATCH] iproute2: initialize the ll_map only once

Avoid initializing the LL map (which involves a costly RTNL dump)
multiple times. This can happen when running in batch mode.

Signed-off-by: Octavian Purdila <opurdila@...acom.com>
---
 lib/ll_map.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/lib/ll_map.c b/lib/ll_map.c
index 9831322..9c6144a 100644
--- a/lib/ll_map.c
+++ b/lib/ll_map.c
@@ -266,6 +266,11 @@ unsigned ll_name_to_index(const char *name)
 
 int ll_init_map(struct rtnl_handle *rth)
 {
+	static int initialized;
+
+	if (initialized)
+		return 0;
+
 	if (rtnl_wilddump_request(rth, AF_UNSPEC, RTM_GETLINK) < 0) {
 		perror("Cannot send dump request");
 		exit(1);
@@ -275,5 +280,8 @@ int ll_init_map(struct rtnl_handle *rth)
 		fprintf(stderr, "Dump terminated\n");
 		exit(1);
 	}
+
+	initialized = 1;
+
 	return 0;
 }
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists