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