• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From b51aef061378b34fa9544b1af34021d89a76547a Mon Sep 17 00:00:00 2001
2From: Phil Sutter <phil@nwl.cc>
3Date: Thu, 26 Jan 2023 03:27:16 +0100
4Subject: [PATCH] ebtables-translate: Print flush command after parsing is
5 finished
6
7Otherwise, bad calls like 'ebtables-translate -F -F' produce wrong
8output instead of an error message.
9
10Conflict: NA
11Reference: https://git.netfilter.org/iptables/commit?id=b51aef061378b34fa9544b1af34021d89a76547a
12
13Signed-off-by: Phil Sutter <phil@nwl.cc>
14---
15 iptables/xtables-eb-translate.c | 14 +++++++-------
16 1 file changed, 7 insertions(+), 7 deletions(-)
17
18diff --git a/iptables/xtables-eb-translate.c b/iptables/xtables-eb-translate.c
19index 99347c0c..da7e5e3d 100644
20--- a/iptables/xtables-eb-translate.c
21+++ b/iptables/xtables-eb-translate.c
22@@ -247,13 +247,6 @@ static int do_commandeb_xlate(struct nft_handle *h, int argc, char *argv[], char
23 			ret = 1;
24 			break;
25 		case 'F': /* Flush */
26-			if (p.chain) {
27-				printf("flush chain bridge %s %s\n", p.table, p.chain);
28-			} else {
29-				printf("flush table bridge %s\n", p.table);
30-			}
31-			ret = 1;
32-			break;
33 		case 'Z': /* Zero counters */
34 			if (c == 'Z') {
35 				if ((flags & OPT_ZERO) || (flags & OPT_COMMAND && command != 'L'))
36@@ -506,6 +499,13 @@ print_zero:
37
38 	if (command == 'P') {
39 		return 0;
40+	} else if (command == 'F') {
41+			if (p.chain) {
42+				printf("flush chain bridge %s %s\n", p.table, p.chain);
43+			} else {
44+				printf("flush table bridge %s\n", p.table);
45+			}
46+			ret = 1;
47 	} else if (command == 'A') {
48 		ret = nft_rule_eb_xlate_add(h, &p, &cs, true);
49 		if (!ret)
50--
512.23.0
52