summaryrefslogtreecommitdiffstats
path: root/tests/py
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-06-08 17:27:18 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2018-06-11 11:31:49 +0200
commitf63b54623fcd1ab7d2f51928571c164409f00175 (patch)
tree49acf0abdbeb4552f66a720fb5ca76a8ce9930d2 /tests/py
parent78f8d8127eac64abb14e1d4a4309b353ba03bdb6 (diff)
JSON: Support latest enhancements of fwd statement
JSON equivalent of fwd statement was too primitive to support the added address and family parameters, so make its value an object and accept the device expression as value of a "dev" property in there. Then add optional "addr" and "family" properties to it. While being at it, add a testcase to make sure the extended syntax works right. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/py')
-rw-r--r--tests/py/any/fwd.t1
-rw-r--r--tests/py/any/fwd.t.json45
-rw-r--r--tests/py/any/fwd.t.json.output30
-rw-r--r--tests/py/any/fwd.t.payload6
4 files changed, 53 insertions, 29 deletions
diff --git a/tests/py/any/fwd.t b/tests/py/any/fwd.t
index d9b4514e..986a16d9 100644
--- a/tests/py/any/fwd.t
+++ b/tests/py/any/fwd.t
@@ -5,3 +5,4 @@
fwd to "lo";ok
fwd to mark map { 0x00000001 : "lo", 0x00000002 : "lo"};ok
+fwd ip to 192.168.2.200 device "lo";ok
diff --git a/tests/py/any/fwd.t.json b/tests/py/any/fwd.t.json
index 644d6d48..e58a8ad2 100644
--- a/tests/py/any/fwd.t.json
+++ b/tests/py/any/fwd.t.json
@@ -1,7 +1,9 @@
# fwd to "lo"
[
{
- "fwd": "lo"
+ "fwd": {
+ "dev": "lo"
+ }
}
]
@@ -9,24 +11,37 @@
[
{
"fwd": {
- "map": {
- "left": {
- "meta": "mark"
- },
- "right": {
- "set": [
- [
- "0x00000001",
- "lo"
- ],
- [
- "0x00000002",
- "lo"
+ "dev": {
+ "map": {
+ "left": {
+ "meta": "mark"
+ },
+ "right": {
+ "set": [
+ [
+ "0x00000001",
+ "lo"
+ ],
+ [
+ "0x00000002",
+ "lo"
+ ]
]
- ]
+ }
}
}
}
}
]
+# fwd ip to 192.168.2.200 device "lo"
+[
+ {
+ "fwd": {
+ "addr": "192.168.2.200",
+ "dev": "lo",
+ "family": "ip"
+ }
+ }
+]
+
diff --git a/tests/py/any/fwd.t.json.output b/tests/py/any/fwd.t.json.output
index 5a943567..e4bad620 100644
--- a/tests/py/any/fwd.t.json.output
+++ b/tests/py/any/fwd.t.json.output
@@ -2,21 +2,23 @@
[
{
"fwd": {
- "map": {
- "left": {
- "meta": "mark"
- },
- "right": {
- "set": [
- [
- 1,
- "lo"
- ],
- [
- 2,
- "lo"
+ "dev": {
+ "map": {
+ "left": {
+ "meta": "mark"
+ },
+ "right": {
+ "set": [
+ [
+ 1,
+ "lo"
+ ],
+ [
+ 2,
+ "lo"
+ ]
]
- ]
+ }
}
}
}
diff --git a/tests/py/any/fwd.t.payload b/tests/py/any/fwd.t.payload
index 696b55ef..966c08b0 100644
--- a/tests/py/any/fwd.t.payload
+++ b/tests/py/any/fwd.t.payload
@@ -12,3 +12,9 @@ netdev test-netdev ingress
[ lookup reg 1 set __map%d dreg 1 ]
[ fwd sreg_dev 1 ]
+# fwd ip to 192.168.2.200 device "lo"
+netdev test-netdev ingress
+ [ immediate reg 1 0x00000001 ]
+ [ immediate reg 2 0xc802a8c0 ]
+ [ fwd sreg_dev 1 sreg_addr 2 nfproto 2 ]
+