ebtables-compat: fix print_header
PATCH 1/3 ebtables-compat: fix print_header
This prints the header like ebtables.
--- iptables/nft-bridge.c | 3 +-- iptables/nft.c | 7 +++++-- 2 files changed, 6 insertions(+), 4 deletions(-)
iptables/nft-bridge.c +1 -2
@@ -362,8 +362,7 @@ static void nft_bridge_print_header(unsigned int format, const char *chain, 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,
iptables/nft.c +5 -2
@@ -2006,6 +2006,9 @@ int nft_rule_list(struct nft_handle *h, const char *chain, const char *table,if (iter ==NULL ) goto err; +if (h->family ==NFPROTO_BRIDGE ) +printf ("Bridge table: %s\n\n" , table); + c =nft_chain_list_iter_next (iter);while (c !=NULL ) { const char *chain_table =
@@ -2033,8 +2036,8 @@ int nft_rule_list(struct nft_handle *h, const char *chain, const char *table,if (found)printf ("\n" ); - ops->print_header (format, chain_name, policy_name[policy], - &ctrs, basechain, refs); + ops->print_header (format, chain_name, + policy_name[policy], &ctrs, basechain, refs);__nft_rule_list (h, chain_name, table, rulenum, format, ops->print_firewall);
Signature · 1 line
1.9.1
PATCH 2/3 nft: fix syntax error
This fixes a syntax error, remove ; in an if statement
--- iptables/nft-shared.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
iptables/nft-shared.c +1 -1
@@ -444,7 +444,7 @@ void nft_parse_cmp(struct nft_xt_ctx *ctx, struct nft_rule_expr *e)if (ctx->flags &NFT_XT_CTX_META ) ops->parse_meta (ctx, e, data);/* bitwise context is interpreted from payload */ -if (ctx->flags &NFT_XT_CTX_PAYLOAD ); +if (ctx->flags &NFT_XT_CTX_PAYLOAD ) ops->parse_payload (ctx, e, data); }
Signature · 1 line
1.9.1
Re: [iptables-compat PATCH 2/3] nft: fix syntax error
Quoted 1 line · Giuseppe Longo
This fixes a syntax error, remove ; in an if statement
Applied to master, thanks.
PATCH 3/3 nft-ipv46: replace offset var with ctx->payload.offset
In reply to Giuseppe LongoThe offset variable (undefined) is passed to DEBUGP function, so you get a compilation error if you try to build iptables with debug enabled
--- iptables/nft-ipv4.c | 2 +- iptables/nft-ipv6.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
iptables/nft-ipv4.c +1 -1
@@ -205,7 +205,7 @@ static void nft_ipv4_parse_payload(struct nft_xt_ctx *ctx, cs->fw.ip.invflags |=IPT_INV_FRAG ;break ;default : -DEBUGP ("unknown payload offset %d\n" , offset); +DEBUGP ("unknown payload offset %d\n" , ctx->payload.offset);break ; } }
iptables/nft-ipv6.c +1 -1
@@ -142,7 +142,7 @@ static void nft_ipv6_parse_payload(struct nft_xt_ctx *ctx,if (inv) cs->fw6.ipv6.invflags |=IPT_INV_PROTO ;default : -DEBUGP ("unknown payload offset %d\n" , offset); +DEBUGP ("unknown payload offset %d\n" , ctx->payload.offset);break ; } }
Signature · 1 line
1.9.1
Re: [iptables-compat PATCH 3/3] nft-ipv46: replace offset var with ctx->payload.offset
Quoted 3 lines · Giuseppe Longo
The offset variable (undefined) is passed to DEBUGP function, so you get a compilation error if you try to build iptables with debug enabled
Applied to master, thanks.
I have rebased the ebtables-compat branch again upon these fixes.
Quoted 1 line · Giuseppe Longo
This prints the header like ebtables.
Applied to the ebtables-compat branch. Thanks.
Pablo Neira Ayuso
maintainerQuoted 4 lines · Pablo Neira Ayuso
Quoted 1 line · Giuseppe Longo
This prints the header like ebtables.
Applied to the ebtables-compat branch. Thanks.
I forgot to say that I made a quick change, so the iptables/nft.c code remains family agnostic.
See the new .print_table_header callback: