From 6deb305b668d0c1f12b5955e76ea5097ca87bf9b Mon Sep 17 00:00:00 2001 From: Liping Zhang Date: Sun, 28 Aug 2016 16:50:48 +0800 Subject: extensions: libip[6]t_REDIRECT: use new nft syntax when do xlate After commit "parser_bison: redirect to :port for consistency with nat/masq statement" in nftables tree, we should recommend the end user to use the new syntax. Before this patch: # iptables-translate -t nat -A PREROUTING -p tcp -j REDIRECT --to-ports 1 nft add rule ip nat PREROUTING ip protocol tcp counter redirect to 1 Apply this patch: # iptables-translate -t nat -A PREROUTING -p tcp -j REDIRECT --to-ports 1 nft add rule ip nat PREROUTING ip protocol tcp counter redirect to :1 Signed-off-by: Liping Zhang Signed-off-by: Pablo Neira Ayuso --- extensions/libip6t_REDIRECT.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extensions/libip6t_REDIRECT.c') diff --git a/extensions/libip6t_REDIRECT.c b/extensions/libip6t_REDIRECT.c index 32f85b96..8e04d2cd 100644 --- a/extensions/libip6t_REDIRECT.c +++ b/extensions/libip6t_REDIRECT.c @@ -138,7 +138,7 @@ static int REDIRECT_xlate(struct xt_xlate *xl, const struct nf_nat_range *range = (const void *)params->target->data; if (range->flags & NF_NAT_RANGE_PROTO_SPECIFIED) { - xt_xlate_add(xl, "redirect to %hu", + xt_xlate_add(xl, "redirect to :%hu", ntohs(range->min_proto.tcp.port)); if (range->max_proto.tcp.port != range->min_proto.tcp.port) xt_xlate_add(xl, "-%hu ", -- cgit v1.2.3