tests: Check for ebtables having been installed
This makes proxyarp_open_ebtables and proxyarp_open_ebtables_ipv6 return SKIP cleanly if the ebtables binary is not installed or does not work. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
4c6f450cad
commit
02538b39b4
1 changed files with 26 additions and 20 deletions
|
@ -4252,9 +4252,12 @@ def _test_proxyarp_open(dev, apdev, params, ebtables=False):
|
||||||
|
|
||||||
if ebtables:
|
if ebtables:
|
||||||
for chain in [ 'FORWARD', 'OUTPUT' ]:
|
for chain in [ 'FORWARD', 'OUTPUT' ]:
|
||||||
subprocess.call(['ebtables', '-A', chain, '-p', 'ARP',
|
try:
|
||||||
'-d', 'Broadcast', '-o', apdev[0]['ifname'],
|
subprocess.call(['ebtables', '-A', chain, '-p', 'ARP',
|
||||||
'-j', 'DROP'])
|
'-d', 'Broadcast', '-o', apdev[0]['ifname'],
|
||||||
|
'-j', 'DROP'])
|
||||||
|
except:
|
||||||
|
raise HwsimSkip("No ebtables available")
|
||||||
|
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
cmd = {}
|
cmd = {}
|
||||||
|
@ -4580,23 +4583,26 @@ def _test_proxyarp_open_ipv6(dev, apdev, params, ebtables=False):
|
||||||
|
|
||||||
if ebtables:
|
if ebtables:
|
||||||
for chain in [ 'FORWARD', 'OUTPUT' ]:
|
for chain in [ 'FORWARD', 'OUTPUT' ]:
|
||||||
subprocess.call(['ebtables', '-A', chain, '-d', 'Multicast',
|
try:
|
||||||
'-p', 'IPv6', '--ip6-protocol', 'ipv6-icmp',
|
subprocess.call(['ebtables', '-A', chain, '-d', 'Multicast',
|
||||||
'--ip6-icmp-type', 'neighbor-solicitation',
|
'-p', 'IPv6', '--ip6-protocol', 'ipv6-icmp',
|
||||||
'-o', apdev[0]['ifname'], '-j', 'DROP'])
|
'--ip6-icmp-type', 'neighbor-solicitation',
|
||||||
subprocess.call(['ebtables', '-A', chain, '-d', 'Multicast',
|
'-o', apdev[0]['ifname'], '-j', 'DROP'])
|
||||||
'-p', 'IPv6', '--ip6-protocol', 'ipv6-icmp',
|
subprocess.call(['ebtables', '-A', chain, '-d', 'Multicast',
|
||||||
'--ip6-icmp-type', 'neighbor-advertisement',
|
'-p', 'IPv6', '--ip6-protocol', 'ipv6-icmp',
|
||||||
'-o', apdev[0]['ifname'], '-j', 'DROP'])
|
'--ip6-icmp-type', 'neighbor-advertisement',
|
||||||
subprocess.call(['ebtables', '-A', chain,
|
'-o', apdev[0]['ifname'], '-j', 'DROP'])
|
||||||
'-p', 'IPv6', '--ip6-protocol', 'ipv6-icmp',
|
subprocess.call(['ebtables', '-A', chain,
|
||||||
'--ip6-icmp-type', 'router-solicitation',
|
'-p', 'IPv6', '--ip6-protocol', 'ipv6-icmp',
|
||||||
'-o', apdev[0]['ifname'], '-j', 'DROP'])
|
'--ip6-icmp-type', 'router-solicitation',
|
||||||
# Multicast Listener Report Message
|
'-o', apdev[0]['ifname'], '-j', 'DROP'])
|
||||||
subprocess.call(['ebtables', '-A', chain, '-d', 'Multicast',
|
# Multicast Listener Report Message
|
||||||
'-p', 'IPv6', '--ip6-protocol', 'ipv6-icmp',
|
subprocess.call(['ebtables', '-A', chain, '-d', 'Multicast',
|
||||||
'--ip6-icmp-type', '143',
|
'-p', 'IPv6', '--ip6-protocol', 'ipv6-icmp',
|
||||||
'-o', apdev[0]['ifname'], '-j', 'DROP'])
|
'--ip6-icmp-type', '143',
|
||||||
|
'-o', apdev[0]['ifname'], '-j', 'DROP'])
|
||||||
|
except:
|
||||||
|
raise HwsimSkip("No ebtables available")
|
||||||
|
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
cmd = {}
|
cmd = {}
|
||||||
|
|
Loading…
Reference in a new issue