]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
ebtables-compat: fix print_header
authorGiuseppe Longo <giuseppelng@gmail.com>
Thu, 16 Oct 2014 14:29:51 +0000 (16:29 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 24 Nov 2014 10:35:34 +0000 (11:35 +0100)
This prints the header like ebtables.

Signed-off-by: Giuseppe Longo <giuseppelng@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
iptables/nft-bridge.c
iptables/nft-shared.h
iptables/nft.c

index ab97881de7efaf0de7660653eb005ce79d5b9057..0e21b468a32dff20df62d67ace4137394df26348 100644 (file)
@@ -357,13 +357,17 @@ static void print_iface(const char *iface)
                *c = IF_WILDCARD;
 }
 
+static void nft_bridge_print_table_header(const char *tablename)
+{
+       printf("Bridge table: %s\n\n", tablename);
+}
+
 static void nft_bridge_print_header(unsigned int format, const char *chain,
                                    const char *pol,
                                    const struct xt_counters *counters,
                                    bool basechain, uint32_t refs)
 {
-       /* FIXME: Giuseppe replace this with ebtables format */
-       print_header(format, chain, pol, counters, basechain, refs);
+       printf("Bridge chain: %s, entries: %u, policy: %s\n", chain, refs, pol);
 }
 
 static void nft_bridge_print_firewall(struct nft_rule *r, unsigned int num,
@@ -564,6 +568,7 @@ struct nft_family_ops nft_family_ops_bridge = {
        .parse_payload          = nft_bridge_parse_payload,
        .parse_immediate        = nft_bridge_parse_immediate,
        .parse_target           = nft_bridge_parse_target,
+       .print_table_header     = nft_bridge_print_table_header,
        .print_header           = nft_bridge_print_header,
        .print_firewall         = nft_bridge_print_firewall,
        .save_firewall          = NULL,
index 361e956646dbe824dd1ae9f1148a97714e6892ea..feef24f92055d1928dad6256bf98b46d627acf04 100644 (file)
@@ -84,6 +84,7 @@ struct nft_family_ops {
                          void *data);
        void (*parse_immediate)(const char *jumpto, bool nft_goto, void *data);
 
+       void (*print_table_header)(const char *tablename);
        void (*print_header)(unsigned int format, const char *chain,
                             const char *pol,
                             const struct xt_counters *counters, bool basechain,
index 804ebe97ee9c26285cf8b8a6e3b4c5cbbb5ab6e1..7cd56efa4f87bacd0d6a61f85a40b4207cbdf3e4 100644 (file)
@@ -2019,6 +2019,9 @@ int nft_rule_list(struct nft_handle *h, const char *chain, const char *table,
        if (iter == NULL)
                goto err;
 
+       if (ops->print_table_header)
+               ops->print_table_header(table);
+
        c = nft_chain_list_iter_next(iter);
        while (c != NULL) {
                const char *chain_table =