tests: Run the proxyarp_open test case both with and without ebtables

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2015-01-30 13:26:12 +02:00 committed by Jouni Malinen
parent 2076846cc4
commit 9934ee1967

View file

@ -2913,10 +2913,15 @@ def get_permanent_neighbors(ifname):
cmd.stdout.close()
return [ line for line in res.splitlines() if "PERMANENT" in line and ifname in line ]
def _test_proxyarp_open(dev, apdev, params):
cap_br = os.path.join(params['logdir'], "proxyarp_open.ap-br0.pcap")
cap_dev0 = os.path.join(params['logdir'], "proxyarp_open.%s.pcap" % dev[0].ifname)
cap_dev1 = os.path.join(params['logdir'], "proxyarp_open.%s.pcap" % dev[1].ifname)
def _test_proxyarp_open(dev, apdev, params, ebtables=False):
prefix = "proxyarp_open"
if ebtables:
prefix += "_ebtables"
cap_br = os.path.join(params['logdir'], prefix + ".ap-br0.pcap")
cap_dev0 = os.path.join(params['logdir'],
prefix + ".%s.pcap" % dev[0].ifname)
cap_dev1 = os.path.join(params['logdir'],
prefix + ".%s.pcap" % dev[1].ifname)
bssid = apdev[0]['bssid']
params = { 'ssid': 'open' }
@ -2939,6 +2944,7 @@ def _test_proxyarp_open(dev, apdev, params):
subprocess.call(['brctl', 'setfd', 'ap-br0', '0'])
subprocess.call(['ip', 'link', 'set', 'dev', 'ap-br0', 'up'])
if ebtables:
for chain in [ 'FORWARD', 'OUTPUT' ]:
subprocess.call(['ebtables', '-A', chain, '-p', 'ARP',
'-d', 'Broadcast', '-o', apdev[0]['ifname'],
@ -3184,7 +3190,9 @@ def _test_proxyarp_open(dev, apdev, params):
logger.info("After disconnect: " + str(matches))
if len(matches) > 0:
raise Exception("Unexpected neighbor entries after disconnect")
cmd = subprocess.Popen(['ebtables', '-L', '--Lc'], stdout=subprocess.PIPE)
if ebtables:
cmd = subprocess.Popen(['ebtables', '-L', '--Lc'],
stdout=subprocess.PIPE)
res = cmd.stdout.read()
cmd.stdout.close()
logger.info("ebtables results:\n" + res)
@ -3193,6 +3201,16 @@ def test_proxyarp_open(dev, apdev, params):
"""ProxyARP with open network"""
try:
_test_proxyarp_open(dev, apdev, params)
finally:
subprocess.call(['ip', 'link', 'set', 'dev', 'ap-br0', 'down'],
stderr=open('/dev/null', 'w'))
subprocess.call(['brctl', 'delbr', 'ap-br0'],
stderr=open('/dev/null', 'w'))
def test_proxyarp_open_ebtables(dev, apdev, params):
"""ProxyARP with open network"""
try:
_test_proxyarp_open(dev, apdev, params, ebtables=True)
finally:
try:
subprocess.call(['ebtables', '-F', 'FORWARD'])