]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
arptables: Print space before comma and counters
authorPhil Sutter <phil@nwl.cc>
Fri, 15 Feb 2019 14:27:43 +0000 (15:27 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 21 Feb 2019 10:23:22 +0000 (11:23 +0100)
Legacy arptables separates counters from rest of rule by ' , '. Assuming
that scripts scraping 'arptables -vL' output match on this, make
arptables-nft output conformant.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
iptables/nft-arp.c
iptables/tests/shell/testcases/arptables/0003-arptables-verbose-output_0

index 637da4274ded3e9f724bfbc6a591efdceecd5d0d..a37155798e85e22da20517f1e41bdfb982ca9f5c 100644 (file)
@@ -617,7 +617,7 @@ nft_arp_print_rule(struct nftnl_rule *r, unsigned int num, unsigned int format)
        print_matches_and_target(&cs, format);
 
        if (!(format & FMT_NOCOUNTS)) {
-               printf(", pcnt=");
+               printf(" , pcnt=");
                xtables_print_num(cs.counters.pcnt, format | FMT_NOTABLE);
                printf("-- bcnt=");
                xtables_print_num(cs.counters.bcnt, format | FMT_NOTABLE);
index 35126fa7d717c84a859b5ae5ff8249892b9489ae..3a9807a1cfe0b74e677a9b1b87db9ec53dbb0fcc 100755 (executable)
@@ -36,16 +36,16 @@ diff -u -Z <(echo -e "$VOUT5") <($XT_MULTI arptables -v -A OUTPUT $RULE5)
 diff -u -Z <(echo -e "$VOUT6") <($XT_MULTI arptables -v -A foo $RULE6)
 
 EXPECT='Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
--j ACCEPT -i eth23 -o *, pcnt=0 -- bcnt=0
--i eth23 -o *, pcnt=0 -- bcnt=0
--j MARK -i eth23 -o * --set-mark 42, pcnt=0 -- bcnt=0
+-j ACCEPT -i eth23 -o * , pcnt=0 -- bcnt=0
+-i eth23 -o * , pcnt=0 -- bcnt=0
+-j MARK -i eth23 -o * --set-mark 42 , pcnt=0 -- bcnt=0
 
 Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
--j CLASSIFY -i * -o eth23 --set-class 23:42, pcnt=0 -- bcnt=0
--j foo -i * -o eth23, pcnt=0 -- bcnt=0
+-j CLASSIFY -i * -o eth23 --set-class 23:42 , pcnt=0 -- bcnt=0
+-j foo -i * -o eth23 , pcnt=0 -- bcnt=0
 
 Chain foo (1 references)
--j mangle -i * -o eth23 --mangle-ip-s 10.0.0.1, pcnt=0 -- bcnt=0'
+-j mangle -i * -o eth23 --mangle-ip-s 10.0.0.1 , pcnt=0 -- bcnt=0'
 
 diff -u -Z <(echo -e "$EXPECT") <($XT_MULTI arptables -v -n -L)