[CRIU] [PATCH 2/4] netdevconf: add get_opt_index() to give index to all options

Pavel Tikhomirov ptikhomirov at parallels.com
Wed Sep 10 01:02:26 PDT 2014


Signed-off-by: Pavel Tikhomirov <ptikhomirov at parallels.com>
---
 net.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/net.c b/net.c
index 206736a..6d9a5f7 100644
--- a/net.c
+++ b/net.c
@@ -450,6 +450,67 @@ static inline int dump_iptables(struct cr_fdset *fds)
 	return run_iptables_tool("iptables-save", -1, fdset_fd(fds, CR_FD_IPTABLES));
 }
 
+int get_opt_index(char *opt) {
+	if (strcmp(opt, "accept_local") == 0)
+		return 0;
+	if (strcmp(opt, "accept_redirects") == 0)
+		return 1;
+	if (strcmp(opt, "accept_source_route") == 0)
+		return 2;
+	if (strcmp(opt, "arp_accept") == 0)
+		return 3;
+	if (strcmp(opt, "arp_announce") == 0)
+		return 4;
+	if (strcmp(opt, "arp_filter") == 0)
+		return 5;
+	if (strcmp(opt, "arp_ignore") == 0)
+		return 6;
+	if (strcmp(opt, "arp_notify") == 0)
+		return 7;
+	if (strcmp(opt, "bootp_relay") == 0)
+		return 8;
+	if (strcmp(opt, "disable_policy") == 0)
+		return 9;
+	if (strcmp(opt, "disable_xfrm") == 0)
+		return 10;
+	if (strcmp(opt, "force_igmp_version") == 0)
+		return 11;
+	if (strcmp(opt, "forwarding") == 0)
+		return 12;
+	if (strcmp(opt, "igmpv2_unsolicited_report_interval") == 0)
+		return 13;
+	if (strcmp(opt, "igmpv3_unsolicited_report_interval") == 0)
+		return 14;
+	if (strcmp(opt, "log_martians") == 0)
+		return 15;
+	if (strcmp(opt, "mc_forwarding") == 0)
+		return 16;
+	if (strcmp(opt, "medium_id") == 0)
+		return 17;
+	if (strcmp(opt, "promote_secondaries") == 0)
+		return 18;
+	if (strcmp(opt, "proxy_arp") == 0)
+		return 19;
+	if (strcmp(opt, "proxy_arp_pvlan") == 0)
+		return 20;
+	if (strcmp(opt, "route_localnet") == 0)
+		return 21;
+	if (strcmp(opt, "rp_filter") == 0)
+		return 22;
+	if (strcmp(opt, "secure_redirects") == 0)
+		return 23;
+	if (strcmp(opt, "send_redirects") == 0)
+		return 24;
+	if (strcmp(opt, "shared_media") == 0)
+		return 25;
+	if (strcmp(opt, "src_valid_mark") == 0)
+		return 26;
+	if (strcmp(opt, "tag") == 0)
+		return 27;
+	pr_err("bad option name");
+	return -1;
+}
+
 static int restore_ip_dump(int type, int pid, char *cmd)
 {
 	int fd, ret;
-- 
1.9.3



More information about the CRIU mailing list