[Libct] [PATCH] net: add a fast path for net_route_setup()

Andrey Vagin avagin at openvz.org
Tue Nov 18 03:09:27 PST 2014


From: Andrew Vagin <avagin at openvz.org>

If routes are not set, we don't need to get information about links.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 src/route.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/route.c b/src/route.c
index fd1a3b0..7248ddf 100644
--- a/src/route.c
+++ b/src/route.c
@@ -152,6 +152,9 @@ int net_route_setup(struct container *ct)
 	struct nl_sock *sk;
 	struct nl_cache *cache;
 
+	if (list_empty(&ct->ct_net_routes))
+		return 0;
+
 	if (switch_ns(ct->root_pid, &net_ns, &rst))
 		return -1;
 
-- 
1.9.1



More information about the Libct mailing list