Commit 30564237 authored by Octavian Purdila's avatar Octavian Purdila Committed by Stephen Hemminger

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: default avatarOctavian Purdila <opurdila@ixiacom.com>
parent 1e21ea71
......@@ -185,6 +185,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);
......@@ -194,5 +199,8 @@ int ll_init_map(struct rtnl_handle *rth)
fprintf(stderr, "Dump terminated\n");
exit(1);
}
initialized = 1;
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment