[prev in list] [next in list] [prev in thread] [next in thread] 

List:       netfilter-devel
Subject:    [PATCH xtables 3/4] ebtables-nft: make -L, -X CHAINNAME work
From:       Florian Westphal <fw () strlen ! de>
Date:       2018-06-28 22:15:27
Message-ID: 20180628221528.3627-3-fw () strlen ! de
[Download RAW message or body]

In both cases the argument is optional, in both cases
the argument wasn't evaluated.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 iptables/xtables-eb.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/iptables/xtables-eb.c b/iptables/xtables-eb.c
index a88bf62c2d56..57026f0e0e02 100644
--- a/iptables/xtables-eb.c
+++ b/iptables/xtables-eb.c
@@ -819,6 +819,11 @@ int do_commandeb(struct nft_handle *h, int argc, char *argv[], char **table)
 				ret = nft_chain_user_add(h, chain, *table);
 				break;
 			} else if (c == 'X') {
+				/* X arg is optional, optarg is NULL */
+				if (!chain && optind < argc && argv[optind][0] != '-') {
+					chain = argv[optind];
+					optind++;
+				}
 				ret = nft_chain_user_del(h, chain, *table);
 				break;
 			}
@@ -897,20 +902,10 @@ print_zero:
 					goto print_zero;
 			}
 
-			/*if (!(replace->flags & OPT_KERNELDATA))
-				ebt_get_kernel_table(replace, 0);
-			i = -1;
 			if (optind < argc && argv[optind][0] != '-') {
-				if ((i = ebt_get_chainnr(replace, argv[optind])) == -1)
-					ebt_print_error2("Chain '%s' doesn't exist", argv[optind]);
+				chain = argv[optind];
 				optind++;
 			}
-			if (i != -1) {
-				if (c == 'Z')
-					zerochain = i;
-				else
-					replace->selected_chain = i;
-			}*/
 			break;
 		case 'V': /* Version */
 			if (OPT_COMMANDS)
-- 
2.16.4

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic