[CRIU] [PATCH 2/3] net: Add flags to run_ip_tool

Pavel Emelyanov xemul at parallels.com
Thu Nov 12 01:14:49 PST 2015


Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 net.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/net.c b/net.c
index 6531071..f85a13c 100644
--- a/net.c
+++ b/net.c
@@ -588,7 +588,7 @@ exit:
 	return ret;
 }
 
-static int run_ip_tool(char *arg1, char *arg2, char *arg3, int fdin, int fdout)
+static int run_ip_tool(char *arg1, char *arg2, char *arg3, int fdin, int fdout, unsigned flags)
 {
 	char *ip_tool_cmd;
 	int ret;
@@ -600,7 +600,7 @@ static int run_ip_tool(char *arg1, char *arg2, char *arg3, int fdin, int fdout)
 		ip_tool_cmd = "ip";
 
 	ret = cr_system(fdin, fdout, -1, ip_tool_cmd,
-				(char *[]) { "ip", arg1, arg2, arg3, NULL }, 0);
+				(char *[]) { "ip", arg1, arg2, arg3, NULL }, flags);
 	if (ret) {
 		pr_err("IP tool failed on %s %s\n", arg1, arg2);
 		return -1;
@@ -628,7 +628,7 @@ static int run_iptables_tool(char *def_cmd, int fdin, int fdout)
 static inline int dump_ifaddr(struct cr_imgset *fds)
 {
 	struct cr_img *img = img_from_set(fds, CR_FD_IFADDR);
-	return run_ip_tool("addr", "save", NULL, -1, img_raw_fd(img));
+	return run_ip_tool("addr", "save", NULL, -1, img_raw_fd(img), 0);
 }
 
 static inline int dump_route(struct cr_imgset *fds)
@@ -636,7 +636,7 @@ static inline int dump_route(struct cr_imgset *fds)
 	struct cr_img *img;
 
 	img = img_from_set(fds, CR_FD_ROUTE);
-	if (run_ip_tool("route", "save", NULL, -1, img_raw_fd(img)))
+	if (run_ip_tool("route", "save", NULL, -1, img_raw_fd(img), 0))
 		return -1;
 
 	/* If ipv6 is disabled, "ip -6 route dump" dumps all routes */
@@ -646,7 +646,7 @@ static inline int dump_route(struct cr_imgset *fds)
 	}
 
 	img = img_from_set(fds, CR_FD_ROUTE6);
-	if (run_ip_tool("-6", "route", "save", -1, img_raw_fd(img)))
+	if (run_ip_tool("-6", "route", "save", -1, img_raw_fd(img), 0))
 		return -1;
 
 	return 0;
@@ -663,7 +663,7 @@ static inline int dump_rule(struct cr_imgset *fds)
 	if (!path)
 		return -1;
 
-	if (run_ip_tool("rule", "save", NULL, -1, img_raw_fd(img))) {
+	if (run_ip_tool("rule", "save", NULL, -1, img_raw_fd(img), 0)) {
 		pr_warn("Check if \"ip rule save\" is supported!\n");
 		unlinkat(get_service_fd(IMG_FD_OFF), path, 0);
 	}
@@ -719,7 +719,7 @@ static int restore_ip_dump(int type, int pid, char *cmd)
 	if (empty_image(img))
 		return 0;
 	if (img) {
-		ret = run_ip_tool(cmd, "restore", NULL, img_raw_fd(img), -1);
+		ret = run_ip_tool(cmd, "restore", NULL, img_raw_fd(img), -1, 0);
 		close_image(img);
 	}
 
@@ -760,9 +760,9 @@ static inline int restore_rule(int pid)
 	 * Delete 3 default rules to prevent duplicates. See kernel's
 	 * function fib_default_rules_init() for the details.
 	 */
-	run_ip_tool("rule", "delete", NULL, -1, -1);
-	run_ip_tool("rule", "delete", NULL, -1, -1);
-	run_ip_tool("rule", "delete", NULL, -1, -1);
+	run_ip_tool("rule", "delete", NULL, -1, -1, 0);
+	run_ip_tool("rule", "delete", NULL, -1, -1, 0);
+	run_ip_tool("rule", "delete", NULL, -1, -1, 0);
 
 	if (restore_ip_dump(CR_FD_RULE, pid, "rule"))
 		ret = -1;
-- 
1.9.3




More information about the CRIU mailing list