]> git.ipfire.org Git - thirdparty/iptables.git/commit
xtables-translate: Fix for interface name corner-cases
authorPhil Sutter <phil@nwl.cc>
Thu, 6 Feb 2020 14:08:41 +0000 (15:08 +0100)
committerPhil Sutter <phil@nwl.cc>
Tue, 11 Feb 2020 09:18:37 +0000 (10:18 +0100)
commite179e87a1179e272a9bdabb0220b17d61d099ee3
tree43361dd6db2b1f8e4e34c64db6acfda266533807
parent8560ef29b1b3f8113f31f19fa57d85778c166c90
xtables-translate: Fix for interface name corner-cases

There are two special situations xlate_ifname() didn't cover for:

* Interface name containing '*': This went unchanged, creating a command
  nft wouldn't accept. Instead translate into '\*' which doesn't change
  semantics.

* Interface name being '+': Can't translate into nft wildcard character
  as nft doesn't accept asterisk-only interface names. Instead decide
  what to do based on 'invert' value: Skip match creation if false,
  match against an invalid interface name if true.

Also add a test to make sure future changes to this behaviour are
noticed.

Signed-off-by: Phil Sutter <phil@nwl.cc>
extensions/generic.txlate
iptables/xtables-translate.c