[RFC 2/2] test: verify multicast_to_unicast operation

Michael Braun michael-dev at fami-braun.de
Mon Oct 31 06:58:09 PDT 2016


Signed-off-by: Michael Braun <michael-dev at fami-braun.de>
---
 hostapd/hostapd.conf               |  1 -
 tests/hwsim/hwsim_utils.py         | 19 ++++++++++++++-----
 tests/hwsim/test_ap_open.py        | 15 +++++++++++++++
 wpa_supplicant/eap_proxy_dummy.mak |  0
 wpa_supplicant/eap_proxy_dummy.mk  |  0
 5 files changed, 29 insertions(+), 6 deletions(-)
 delete mode 100644 wpa_supplicant/eap_proxy_dummy.mak
 delete mode 100644 wpa_supplicant/eap_proxy_dummy.mk

diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index 16fb9ec..9a60fd1 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -495,7 +495,6 @@ wmm_ac_vo_acm=0
 # if this new option is enabled.)
 #
 # This also doesn't implement the 802.11 DMS (directed multicast service).
-#
 #multicast_to_unicast=0
 
 ##### IEEE 802.11n related configuration ######################################
diff --git a/tests/hwsim/hwsim_utils.py b/tests/hwsim/hwsim_utils.py
index 06df859..459e1fb 100644
--- a/tests/hwsim/hwsim_utils.py
+++ b/tests/hwsim/hwsim_utils.py
@@ -12,7 +12,8 @@ logger = logging.getLogger()
 from wpasupplicant import WpaSupplicant
 
 def run_connectivity_test(dev1, dev2, tos, dev1group=False, dev2group=False,
-                          ifname1=None, ifname2=None, config=True, timeout=5):
+                          ifname1=None, ifname2=None, config=True, timeout=5,
+                          multicast_to_unicast=False):
     addr1 = dev1.own_addr()
     if not dev1group and isinstance(dev1, WpaSupplicant):
         addr1 = dev1.get_driver_status_field('addr')
@@ -114,8 +115,14 @@ def run_connectivity_test(dev1, dev2, tos, dev1group=False, dev2group=False,
                     ev = dev1.wait_event(["DATA-TEST-RX"], timeout=timeout)
                 if ev is None:
                     raise Exception("dev2->dev1 broadcast data delivery failed")
-                if "DATA-TEST-RX ff:ff:ff:ff:ff:ff {}".format(addr2) not in ev:
-                    raise Exception("Unexpected dev2->dev1 broadcast data result")
+                if multicast_to_unicast:
+                   if "DATA-TEST-RX ff:ff:ff:ff:ff:ff {}".format(addr2) in ev:
+                        raise Exception("Unexpected dev2->dev1 broadcast data result: multicast to unicast conversion missing")
+                   if "DATA-TEST-RX {} {}".format(addr1, addr2) not in ev:
+                        raise Exception("Unexpected dev2->dev1 broadcast data result (multicast to unicast enabled)")
+                else:
+                   if "DATA-TEST-RX ff:ff:ff:ff:ff:ff {}".format(addr2) not in ev:
+                        raise Exception("Unexpected dev2->dev1 broadcast data result")
                 break
             except Exception as e:
                 if i == broadcast_retry_c - 1:
@@ -133,7 +140,8 @@ def run_connectivity_test(dev1, dev2, tos, dev1group=False, dev2group=False,
 
 def test_connectivity(dev1, dev2, dscp=None, tos=None, max_tries=1,
                       dev1group=False, dev2group=False,
-                      ifname1=None, ifname2=None, config=True, timeout=5):
+                      ifname1=None, ifname2=None, config=True, timeout=5,
+                      multicast_to_unicast=False):
     if dscp:
         tos = dscp << 2
     if not tos:
@@ -145,7 +153,8 @@ def test_connectivity(dev1, dev2, dscp=None, tos=None, max_tries=1,
         try:
             run_connectivity_test(dev1, dev2, tos, dev1group, dev2group,
                                   ifname1, ifname2, config=config,
-                                  timeout=timeout)
+                                  timeout=timeout,
+				  multicast_to_unicast=multicast_to_unicast)
             success = True
             break
         except Exception, e:
diff --git a/tests/hwsim/test_ap_open.py b/tests/hwsim/test_ap_open.py
index 409d413..c46dee4 100644
--- a/tests/hwsim/test_ap_open.py
+++ b/tests/hwsim/test_ap_open.py
@@ -608,3 +608,18 @@ def test_ap_open_drv_fail(dev, apdev):
                        wait_connect=False)
         wait_fail_trigger(dev[0], "GET_FAIL")
         dev[0].request("REMOVE_NETWORK all")
+
+def test_ap_open_multicast_to_unicast(dev, apdev):
+    hapd = hostapd.add_ap(apdev[0], { "ssid": "open", "multicast_to_unicast": "1" })
+    dev[0].connect("open", key_mgmt="NONE", scan_freq="2412",
+                   bg_scan_period="0")
+    ev = hapd.wait_event([ "AP-STA-CONNECTED" ], timeout=5)
+    if ev is None:
+        raise Exception("No connection event received from hostapd")
+    hwsim_utils.test_connectivity(dev[0], hapd, multicast_to_unicast=True)
+    time.sleep(30)
+
+    dev[0].request("DISCONNECT")
+    ev = hapd.wait_event([ "AP-STA-DISCONNECTED" ], timeout=5)
+    if ev is None:
+        raise Exception("No disconnection event received from hostapd")
diff --git a/wpa_supplicant/eap_proxy_dummy.mak b/wpa_supplicant/eap_proxy_dummy.mak
deleted file mode 100644
index e69de29..0000000
diff --git a/wpa_supplicant/eap_proxy_dummy.mk b/wpa_supplicant/eap_proxy_dummy.mk
deleted file mode 100644
index e69de29..0000000
-- 
2.1.4




More information about the Hostap mailing list