]> git.ipfire.org Git - thirdparty/iptables.git/commit
extensions: libip6t_SNAT/DNAT: add square bracket in xlat output when port is specified
authorLiping Zhang <liping.zhang@spreadtrum.com>
Fri, 2 Sep 2016 12:47:05 +0000 (20:47 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 5 Sep 2016 17:12:48 +0000 (19:12 +0200)
commit19b38b83b0f5f99179e7bc8f1989df73f44dc0b7
treeae0b0b5f2127fd02f04f3f6c76e07bd92b857f6e
parent3105ed4f38752eafc4340dfa402cc12226107aa1
extensions: libip6t_SNAT/DNAT: add square bracket in xlat output when port is specified

It is better to add square brackets to ip6 address in nft translation
output when the port is specified. This is keep consistent with the
nft syntax.

Before this patch:
  # ip6tables-translate -t nat -A OUTPUT -p tcp -j DNAT --to-destination \
  [123::4]:1
  nft add rule ip6 nat OUTPUT meta l4proto tcp counter dnat to 123::4 :1
  # ip6tables-translate -t nat -A POSTROUTING -p tcp -j SNAT --to-source \
  [123::4-123::8]:1
  nft add rule ip6 nat POSTROUTING meta l4proto tcp counter snat to 123::4-123::8 :1

Apply this patch:
  # ip6tables-translate -t nat -A OUTPUT -p tcp -j DNAT --to-destination \
  [123::4]:1
  nft add rule ip6 nat OUTPUT meta l4proto tcp counter dnat to [123::4]:1
  # ip6tables-translate -t nat -A POSTROUTING -p tcp -j SNAT --to-source \
  [123::4-123::8]:1
  nft add rule ip6 nat POSTROUTING meta l4proto tcp counter snat to [123::4]-[123::8]:1

Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
extensions/libip6t_DNAT.c
extensions/libip6t_SNAT.c