tests: Skip proxyarp tests properly if ebtables rule install fails

Otherwise the test will continue on and fail later due to unexpected
foreign ARP request. The try/except design here did not work properly to
detect this.

Signed-off-by: Thomas Pedersen <thomas@adapt-ip.com>
This commit is contained in:
Thomas Pedersen 2020-05-01 14:02:10 -07:00 committed by Jouni Malinen
parent 82f2e3ddce
commit 7ec86f6599

View File

@ -4672,9 +4672,12 @@ def _test_proxyarp_open(dev, apdev, params, ebtables=False):
if ebtables:
for chain in ['FORWARD', 'OUTPUT']:
try:
subprocess.call(['ebtables', '-A', chain, '-p', 'ARP',
'-d', 'Broadcast', '-o', apdev[0]['ifname'],
'-j', 'DROP'])
err = subprocess.call(['ebtables', '-A', chain, '-p', 'ARP',
'-d', 'Broadcast',
'-o', apdev[0]['ifname'],
'-j', 'DROP'])
if err != 0:
raise
except:
raise HwsimSkip("No ebtables available")
@ -4998,10 +5001,15 @@ def _test_proxyarp_open_ipv6(dev, apdev, params, ebtables=False):
if ebtables:
for chain in ['FORWARD', 'OUTPUT']:
try:
subprocess.call(['ebtables', '-A', chain, '-d', 'Multicast',
'-p', 'IPv6', '--ip6-protocol', 'ipv6-icmp',
'--ip6-icmp-type', 'neighbor-solicitation',
'-o', apdev[0]['ifname'], '-j', 'DROP'])
err = subprocess.call(['ebtables', '-A', chain,
'-d', 'Multicast',
'-p', 'IPv6',
'--ip6-protocol', 'ipv6-icmp',
'--ip6-icmp-type',
'neighbor-solicitation',
'-o', apdev[0]['ifname'], '-j', 'DROP'])
if err != 0:
raise
subprocess.call(['ebtables', '-A', chain, '-d', 'Multicast',
'-p', 'IPv6', '--ip6-protocol', 'ipv6-icmp',
'--ip6-icmp-type', 'neighbor-advertisement',