File:  [ELWIX - Embedded LightWeight unIX -] / fwsync / patches / ipfw_main.patch
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Wed Jun 22 13:01:55 2022 UTC (2 years, 1 month ago) by misho
Branches: MAIN
CVS tags: HEAD
Initial revision

    1: diff --git a/sbin/ipfw/main.c b/sbin/ipfw/main.c
    2: index 89f21062811..9c773aa4364 100644
    3: --- a/sbin/ipfw/main.c
    4: +++ b/sbin/ipfw/main.c
    5: @@ -41,6 +41,8 @@ help(void)
    6:  "\tipfw [-abcdefhnNqStTv] <command>\n\n"
    7:  "where <command> is one of the following:\n\n"
    8:  "add [num] [set N] [prob x] RULE-BODY\n"
    9: +"sync {start [edge|collector]|config [edge <port>|collector <ip,port>]|\n"
   10: +"		show [config|status]|stop [edge|collector]|flush [edge|collector]}\n"
   11:  "{pipe|queue} N config PIPE-BODY\n"
   12:  "[pipe|queue] {zero|delete|show} [N{,N}]\n"
   13:  "nat N config {ip IPADDR|if IFNAME|log|deny_in|same_ports|unreg_only|unreg_cgn|\n"
   14: @@ -364,11 +366,14 @@ ipfw_main(int oldac, char **oldav)
   15:  	/*
   16:  	 * Optional: pipe, queue or nat.
   17:  	 */
   18: +	g_co.do_sync = 0;
   19:  	g_co.do_nat = 0;
   20:  	g_co.do_pipe = 0;
   21:  	g_co.use_set = 0;
   22:  	if (!strncmp(*av, "nat", strlen(*av)))
   23:  		g_co.do_nat = 1;
   24: +	else if (!strncmp(*av, "sync", strlen(*av)))
   25: +		g_co.do_sync = 1;
   26:  	else if (!strncmp(*av, "pipe", strlen(*av)))
   27:  		g_co.do_pipe = 1;
   28:  	else if (_substrcmp(*av, "queue") == 0)
   29: @@ -388,7 +393,7 @@ ipfw_main(int oldac, char **oldav)
   30:  		}
   31:  	}
   32:  
   33: -	if (g_co.do_pipe || g_co.do_nat) {
   34: +	if (g_co.do_pipe || g_co.do_nat || g_co.do_sync) {
   35:  		ac--;
   36:  		av++;
   37:  	}
   38: @@ -399,7 +404,7 @@ ipfw_main(int oldac, char **oldav)
   39:  	 * but the code is easier to parse as 'nat|pipe config NN'
   40:  	 * so we swap the two arguments.
   41:  	 */
   42: -	if ((g_co.do_pipe || g_co.do_nat) && ac > 1 && isdigit(*av[0])) {
   43: +	if ((g_co.do_pipe || g_co.do_nat || g_co.do_sync) && ac > 1 && isdigit(*av[0])) {
   44:  		char *p = av[0];
   45:  
   46:  		av[0] = av[1];
   47: @@ -411,10 +416,20 @@ ipfw_main(int oldac, char **oldav)
   48:  			ipfw_add(av);
   49:  		else if (g_co.do_nat && _substrcmp(*av, "show") == 0)
   50:   			ipfw_show_nat(ac, av);
   51: +		else if (g_co.do_sync && _substrcmp(*av, "show") == 0)
   52: + 			ipfw_show_sync(ac, av);
   53: +		else if (g_co.do_sync && _substrcmp(*av, "start") == 0)
   54: + 			ipfw_start_sync(ac, av);
   55: +		else if (g_co.do_sync && _substrcmp(*av, "stop") == 0)
   56: + 			ipfw_stop_sync(ac, av);
   57: +		else if (g_co.do_sync && _substrcmp(*av, "flush") == 0)
   58: + 			ipfw_flush_sync(ac, av);
   59:  		else if (g_co.do_pipe && _substrcmp(*av, "config") == 0)
   60:  			ipfw_config_pipe(ac, av);
   61:  		else if (g_co.do_nat && _substrcmp(*av, "config") == 0)
   62:   			ipfw_config_nat(ac, av);
   63: +		else if (g_co.do_sync&& _substrcmp(*av, "config") == 0)
   64: + 			ipfw_config_sync(ac, av);
   65:  		else if (_substrcmp(*av, "set") == 0)
   66:  			ipfw_sets_handler(av);
   67:  		else if (_substrcmp(*av, "table") == 0)

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