Commit f84974e7 authored by David S. Miller's avatar David S. Miller

Merge branch 'tc-testing-dnat-tuple-collision'

Marcelo Ricardo Leitner says:

====================
tc-testing: add test for ct DNAT tuple collision

That was fixed in 13c62f53 ("net/sched: act_ct: handle DNAT tuple
collision").

For that, it requires that tdc is able to send diverse packets with
scapy, which is then done on the 2nd patch of this series.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 1b134d8d e4690564
...@@ -29,22 +29,26 @@ class SubPlugin(TdcPlugin): ...@@ -29,22 +29,26 @@ class SubPlugin(TdcPlugin):
return return
# Check for required fields # Check for required fields
scapyinfo = self.args.caseinfo['scapy'] lscapyinfo = self.args.caseinfo['scapy']
scapy_keys = ['iface', 'count', 'packet'] if type(lscapyinfo) != list:
missing_keys = [] lscapyinfo = [ lscapyinfo, ]
keyfail = False
for k in scapy_keys: for scapyinfo in lscapyinfo:
if k not in scapyinfo: scapy_keys = ['iface', 'count', 'packet']
keyfail = True missing_keys = []
missing_keys.add(k) keyfail = False
if keyfail: for k in scapy_keys:
print('{}: Scapy block present in the test, but is missing info:' if k not in scapyinfo:
.format(self.sub_class)) keyfail = True
print('{}'.format(missing_keys)) missing_keys.append(k)
if keyfail:
pkt = eval(scapyinfo['packet']) print('{}: Scapy block present in the test, but is missing info:'
if '$' in scapyinfo['iface']: .format(self.sub_class))
tpl = Template(scapyinfo['iface']) print('{}'.format(missing_keys))
scapyinfo['iface'] = tpl.safe_substitute(NAMES)
for count in range(scapyinfo['count']): pkt = eval(scapyinfo['packet'])
sendp(pkt, iface=scapyinfo['iface']) if '$' in scapyinfo['iface']:
tpl = Template(scapyinfo['iface'])
scapyinfo['iface'] = tpl.safe_substitute(NAMES)
for count in range(scapyinfo['count']):
sendp(pkt, iface=scapyinfo['iface'])
...@@ -406,5 +406,50 @@ ...@@ -406,5 +406,50 @@
"teardown": [ "teardown": [
"$TC actions flush action ct" "$TC actions flush action ct"
] ]
},
{
"id": "3992",
"name": "Add ct action triggering DNAT tuple conflict",
"category": [
"actions",
"ct",
"scapy"
],
"plugins": {
"requires": [
"nsPlugin",
"scapyPlugin"
]
},
"setup": [
[
"$TC qdisc del dev $DEV1 ingress",
0,
1,
2,
255
],
"$TC qdisc add dev $DEV1 ingress"
],
"cmdUnderTest": "$TC filter add dev $DEV1 ingress protocol ip prio 1 flower ct_state -trk action ct commit nat dst addr 20.0.0.1 port 10 pipe action drop",
"scapy": [
{
"iface": "$DEV0",
"count": 1,
"packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.10')/TCP(sport=5000,dport=10)"
},
{
"iface": "$DEV0",
"count": 1,
"packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.20')/TCP(sport=5000,dport=10)"
}
],
"expExitCode": "0",
"verifyCmd": "cat /proc/net/nf_conntrack",
"matchPattern": "dst=10.0.0.20",
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DEV1 ingress"
]
} }
] ]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment