aboutsummaryrefslogtreecommitdiff
path: root/extensions/generic.txlate
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2021-06-21 14:27:29 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2021-06-21 14:27:29 +0000
commit534e6f9339b644ffac02190dd32257bb190e3356 (patch)
treed3b12fcc78b5ad0e8e25c7e3f068be047b461d91 /extensions/generic.txlate
parent735bd681a5ee12a17c67917603467acaf4a58f33 (diff)
parentfae46950c0c0818cac1b37a7042b86fb03a75511 (diff)
downloadiptables-android12-mainline-adbd-release.tar.gz
Change-Id: I9fc6994d9e9199c968ae3ec824b9d8e629c16169
Diffstat (limited to 'extensions/generic.txlate')
-rw-r--r--extensions/generic.txlate16
1 files changed, 16 insertions, 0 deletions
diff --git a/extensions/generic.txlate b/extensions/generic.txlate
index b38fbd1f..0e256c37 100644
--- a/extensions/generic.txlate
+++ b/extensions/generic.txlate
@@ -18,3 +18,19 @@ nft add rule bridge filter FORWARD iifname != "iname" meta ibrname "ilogname" oi
ebtables-translate -I INPUT -p ip -d 1:2:3:4:5:6/ff:ff:ff:ff:00:00
nft insert rule bridge filter INPUT ether type 0x800 ether daddr 01:02:03:04:00:00 and ff:ff:ff:ff:00:00 == 01:02:03:04:00:00 counter
+
+# asterisk is not special in iptables and it is even a valid interface name
+iptables-translate -A FORWARD -i '*' -o 'eth*foo'
+nft add rule ip filter FORWARD iifname "\*" oifname "eth\*foo" counter
+
+# escape all asterisks but translate only the first plus character
+iptables-translate -A FORWARD -i 'eth*foo*+' -o 'eth++'
+nft add rule ip filter FORWARD iifname "eth\*foo\**" oifname "eth+*" counter
+
+# skip for always matching interface names
+iptables-translate -A FORWARD -i '+'
+nft add rule ip filter FORWARD counter
+
+# match against invalid interface name to simulate never matching rule
+iptables-translate -A FORWARD ! -i '+'
+nft add rule ip filter FORWARD iifname "INVAL/D" counter