From: Thomas Pedersen Date: Fri, 1 May 2020 21:02:10 +0000 (-0700) Subject: tests: Skip proxyarp tests properly if ebtables rule install fails X-Git-Tag: hostap_2_10~1391 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ec86f6599c5e76796246d6d9dee7841f73150cd;p=thirdparty%2Fhostap.git 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 --- diff --git a/tests/hwsim/test_ap_hs20.py b/tests/hwsim/test_ap_hs20.py index c484b5003..863567eb1 100644 --- a/tests/hwsim/test_ap_hs20.py +++ b/tests/hwsim/test_ap_hs20.py @@ -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',