]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Skip proxyarp tests properly if ebtables rule install fails
authorThomas Pedersen <thomas@adapt-ip.com>
Fri, 1 May 2020 21:02:10 +0000 (14:02 -0700)
committerJouni Malinen <j@w1.fi>
Sun, 3 May 2020 15:46:34 +0000 (18:46 +0300)
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>
tests/hwsim/test_ap_hs20.py

index c484b500352e8fbd3a8ee288ab16b51ebf4d433b..863567eb1669fcaa194eca0127dab2589b1d4f58 100644 (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',