]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
ebtables-translate: Print flush command after parsing is finished
authorPhil Sutter <phil@nwl.cc>
Thu, 26 Jan 2023 02:27:16 +0000 (03:27 +0100)
committerPhil Sutter <phil@nwl.cc>
Tue, 31 Jan 2023 15:29:26 +0000 (16:29 +0100)
Otherwise, bad calls like 'ebtables-translate -F -F' produce wrong
output instead of an error message.

Signed-off-by: Phil Sutter <phil@nwl.cc>
iptables/xtables-eb-translate.c

index 99347c0c3ee465666878171f97eb833f8df09df4..da7e5e3dda1f3554e971a7ee2f75331af110e697 100644 (file)
@@ -247,13 +247,6 @@ static int do_commandeb_xlate(struct nft_handle *h, int argc, char *argv[], char
                        ret = 1;
                        break;
                case 'F': /* Flush */
-                       if (p.chain) {
-                               printf("flush chain bridge %s %s\n", p.table, p.chain);
-                       } else {
-                               printf("flush table bridge %s\n", p.table);
-                       }
-                       ret = 1;
-                       break;
                case 'Z': /* Zero counters */
                        if (c == 'Z') {
                                if ((flags & OPT_ZERO) || (flags & OPT_COMMAND && command != 'L'))
@@ -506,6 +499,13 @@ print_zero:
 
        if (command == 'P') {
                return 0;
+       } else if (command == 'F') {
+                       if (p.chain) {
+                               printf("flush chain bridge %s %s\n", p.table, p.chain);
+                       } else {
+                               printf("flush table bridge %s\n", p.table);
+                       }
+                       ret = 1;
        } else if (command == 'A') {
                ret = nft_rule_eb_xlate_add(h, &p, &cs, true);
                if (!ret)