File:  [ELWIX - Embedded LightWeight unIX -] / fwsync / patches / ipfw_main.patch
Revision 1.3: download - view: text, annotated - select for diffs - revision graph
Fri Aug 26 14:47:36 2022 UTC (20 months ago) by misho
Branches: MAIN
CVS tags: fwsync1_2, HEAD, FWSYNC1_1
version 1.1
 - adds list command

diff --git a/sbin/ipfw/main.c b/sbin/ipfw/main.c
index 1b9c7f324a9..583545dbde5 100644
--- a/sbin/ipfw/main.c
+++ b/sbin/ipfw/main.c
@@ -42,6 +42,8 @@ help(void)
 "\tipfw [-abcdefhnNqStTv] <command>\n\n"
 "where <command> is one of the following:\n\n"
 "add [num] [set N] [prob x] RULE-BODY\n"
+"sync {start [edge|collector]|config [edge <port>|collector <ip,port>]|\n"
+"		show|list [edge|collector]|stop [edge|collector]|flush [edge|collector]}\n"
 "{pipe|queue} N config PIPE-BODY\n"
 "[pipe|queue] {zero|delete|show} [N{,N}]\n"
 "nat N config {ip IPADDR|if IFNAME|log|deny_in|same_ports|unreg_only|unreg_cgn|\n"
@@ -404,11 +406,14 @@ ipfw_main(int oldac, char **oldav)
 	/*
 	 * Optional: pipe, queue or nat.
 	 */
+	g_co.do_sync = 0;
 	g_co.do_nat = 0;
 	g_co.do_pipe = 0;
 	g_co.use_set = 0;
 	if (is_ipfw() && !strncmp(*av, "nat", strlen(*av)))
 		g_co.do_nat = 1;
+	else if (!strncmp(*av, "sync", strlen(*av)))
+		g_co.do_sync = 1;
 	else if (!strncmp(*av, "pipe", strlen(*av)))
 		g_co.do_pipe = 1;
 	else if (_substrcmp(*av, "queue") == 0)
@@ -428,7 +433,7 @@ ipfw_main(int oldac, char **oldav)
 		}
 	}
 
-	if (g_co.do_pipe || g_co.do_nat) {
+	if (g_co.do_pipe || g_co.do_nat || g_co.do_sync) {
 		ac--;
 		av++;
 	}
@@ -439,7 +444,7 @@ ipfw_main(int oldac, char **oldav)
 	 * but the code is easier to parse as 'nat|pipe config NN'
 	 * so we swap the two arguments.
 	 */
-	if ((g_co.do_pipe || g_co.do_nat) && ac > 1 && isdigit(*av[0])) {
+	if ((g_co.do_pipe || g_co.do_nat || g_co.do_sync) && ac > 1 && isdigit(*av[0])) {
 		char *p = av[0];
 
 		av[0] = av[1];
@@ -455,6 +460,18 @@ ipfw_main(int oldac, char **oldav)
 			ipfw_add(av);
 		else if (g_co.do_nat && _substrcmp(*av, "show") == 0)
  			ipfw_show_nat(ac, av);
+		else if (g_co.do_sync && _substrcmp(*av, "show") == 0)
+ 			ipfw_show_sync(ac, av);
+		else if (g_co.do_sync && _substrcmp(*av, "list") == 0)
+ 			ipfw_list_sync(ac, av);
+		else if (g_co.do_sync && _substrcmp(*av, "start") == 0)
+ 			ipfw_start_sync(ac, av);
+		else if (g_co.do_sync && _substrcmp(*av, "stop") == 0)
+ 			ipfw_stop_sync(ac, av);
+		else if (g_co.do_sync && _substrcmp(*av, "flush") == 0)
+ 			ipfw_flush_sync(ac, av);
+		else if (g_co.do_sync&& _substrcmp(*av, "config") == 0)
+ 			ipfw_config_sync(ac, av);
 		else if (g_co.do_pipe && _substrcmp(*av, "config") == 0)
 			ipfw_config_pipe(ac, av);
 		else if (g_co.do_nat && _substrcmp(*av, "config") == 0)

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>