[v8,00/16] mesh: enable DFS channels in mesh mode
mbox series

Message ID cover.1535403927.git.peter.oh@bowerswilkins.com
Headers show
Series
  • mesh: enable DFS channels in mesh mode
Related show

Message

Peter Oh Aug. 27, 2018, 9:28 p.m. UTC
From: Peter Oh <peter.oh@bowerswilkins.com>

This patchset enables DFS channels in mesh mode along with
CAC and channel switch.
It's been verified that works for non-dfs channels, dfs channels,
w/wo encryption (none and SAE), radar detection, channel switch,
and mesh re-association after channel switch.
Also this patch series passes all the test cases in wpas_mesh.
Only left area to cover is in the case when multiple mesh points
detect radar at the same time, but they select different channels.
To cover the case I think we need a private patch for it,
because current 802.11s standard does not address it how to handle.

* v2: corrected wrong sender's email.
* v3: rebased on top of "mesh: Properly handle sae_password".
      fix compiler warnings on unused variables and parentheses.
* v4: updated "allow mesh to send channel switch request" patch
      based on "2dd5fbbff wpa_supplicant: Rename wpas_event_*".
      fix channel switch error during CAC.
* v5: some changes in "Allow DFS channels to be selected"
      moves to "consider mesh interface on dfs event handler" to
      group the similar changes together.
* v6: fixed memory leak.
      updated ieee80211_is_dfs() usage based on "d239ab396 DFS:
      Mark channels required DFS based on reg-domain" commit.
      removed "mesh: allow mesh to send channel switch request"
      which is already merged to master branch.
      move "mesh: inform kernel driver DFS handler in userspace"
      patch to the last.
* v7: dropped pri/sec channel swap related patches
      fixed "wpas_mesh_secure_sae_missing_password" test case
      fixed memory leak at wpa_driver_nl80211_send_action()
      use operating channel to determine DFS channel
* v8: fixed failed test cases in wpas_mesh.
      re-introduce a pri/sec channel swap patch

Peter Oh (16):
  mesh: factor out mesh join function
  mesh: factor out rsn initialization
  tests: Update mesh_oom to match implementation change
  mesh: relocate RSN init function
  mesh: use setup completion callback to complete mesh join
  mesh: reflect country setting to mesh configuration
  mesh: apply channel attributes before setup interface
  mesh: update ssid->frequency as pri/sec channel switch
  mesh: set interface type to mesh before setting interface
  mesh: set mesh center frequency
  mesh: consider mesh interface on dfs event handler
  mesh: Allow DFS channels to be selected if dfs is enabled
  mesh: do not set offchanok on DFS channels in non-ETSI
  mesh: fix channel switch error during CAC
  mesh: don't allow pri/sec channel switch
  mesh: inform kernel driver DFS handler in userspace

 src/ap/hostapd.c                  |  11 +-
 src/drivers/driver.h              |   1 +
 src/drivers/driver_nl80211.c      |  24 +++-
 tests/hwsim/test_wpas_mesh.py     |   2 +-
 wpa_supplicant/ap.c               |  71 +++++++---
 wpa_supplicant/events.c           |   7 +-
 wpa_supplicant/mesh.c             | 264 ++++++++++++++++++++++++--------------
 wpa_supplicant/wpa_supplicant.c   |  24 +++-
 wpa_supplicant/wpa_supplicant_i.h |   1 +
 9 files changed, 280 insertions(+), 125 deletions(-)

Comments

Masashi Honma Aug. 28, 2018, 4:03 a.m. UTC | #1
On 2018/08/28 06:28, peter.oh@bowerswilkins.com wrote:
> From: Peter Oh <peter.oh@bowerswilkins.com>
> * v8: fixed failed test cases in wpas_mesh.
>        re-introduce a pri/sec channel swap patch

Thank you, this patch passes existing mesh test cases on my environment 
also.

I expect this patch provides DFS-CAC-START and DFS-CAC-COMPLETED events.
To check that, I created a my test case (mesh_dfs_test.patch).
I could see DFS-CAC-START. But I saw a DFS_CAC_ABORTED event instead of 
DFS-CAC-COMPLETED events. Log file is 1535428477.tar.xz.

Could you provide working test case if possible ?

Regards,
Masashi Honma.
diff --git a/tests/hwsim/test_wpas_mesh.py b/tests/hwsim/test_wpas_mesh.py
index a3986fd..14f3190 100644
--- a/tests/hwsim/test_wpas_mesh.py
+++ b/tests/hwsim/test_wpas_mesh.py
@@ -18,6 +18,8 @@ from utils import HwsimSkip, alloc_fail, fail_test, wait_fail_trigger
 from tshark import run_tshark
 from test_ap_ht import set_world_reg
 from hwsim_utils import set_group_map
+from test_dfs import wait_dfs_event
+from test_p2p_channel import set_country
 
 def check_mesh_support(dev, secure=False):
     if "MESH" not in dev.get_capability("modes"):
@@ -1127,6 +1129,49 @@ def _test_mesh_open_vht_160(dev, apdev):
     dev[0].dump_monitor()
     dev[1].dump_monitor()
 
+def test_wpas_mesh_open_dfs(dev, apdev):
+    """wpa_supplicant open MESH network with DFS"""
+    try:
+        _test_wpas_mesh_open_dfs(dev, apdev)
+    finally:
+        set_country("00")
+
+def _test_wpas_mesh_open_dfs(dev, apdev):
+    set_country("US")
+    for i in range(0, 2):
+        dev[i].request("SET country US")
+        check_mesh_support(dev[i])
+        add_open_mesh_network(dev[i], freq="5260", basic_rates="60 120 240",
+                              disable_ht40=True)
+
+        ev = wait_dfs_event(dev[i], "DFS-CAC-START", 5)
+        if "DFS-CAC-START" not in ev:
+            # For now, assume DFS is not supported by all kernel builds.
+            raise HwsimSkip("CAC did not start - assume not supported")
+
+        ev = wait_dfs_event(dev[i], "DFS-CAC-COMPLETED", 30)
+        if "success=1" not in ev:
+            raise Exception("CAC failed")
+        if "freq=5260" not in ev:
+            raise Exception("Unexpected DFS freq result")
+
+        # Check for mesh joined
+        check_mesh_group_added(dev[i])
+
+    # Check for peer connected
+    for i in range(0, 2):
+        check_mesh_peer_connected(dev[i])
+
+    # Test connectivity 0->1 and 1->0
+    hwsim_utils.test_connectivity(dev[0], dev[1])
+
+    dev[0].mesh_group_remove()
+    dev[1].mesh_group_remove()
+    check_mesh_group_removed(dev[0])
+    check_mesh_group_removed(dev[1])
+    dev[0].dump_monitor()
+    dev[1].dump_monitor()
+
 def test_wpas_mesh_password_mismatch(dev, apdev):
     """Mesh network and one device with mismatching password"""
     check_mesh_support(dev[0], secure=True)
Jouni Malinen Jan. 3, 2019, 1:13 p.m. UTC | #2
On Mon, Aug 27, 2018 at 02:28:33PM -0700, peter.oh@bowerswilkins.com wrote:
> This patchset enables DFS channels in mesh mode along with
> CAC and channel switch.
> It's been verified that works for non-dfs channels, dfs channels,
> w/wo encryption (none and SAE), radar detection, channel switch,
> and mesh re-association after channel switch.
> Also this patch series passes all the test cases in wpas_mesh.
> Only left area to cover is in the case when multiple mesh points
> detect radar at the same time, but they select different channels.
> To cover the case I think we need a private patch for it,
> because current 802.11s standard does not address it how to handle.

Thanks, I applied patches 1-4, 6-7, and 9-11 with cleanup. The other
patches have either open question or dependencies to patches that have
open questions, so I dropped them from my queue.
Jouni Malinen Jan. 3, 2019, 1:44 p.m. UTC | #3
On Tue, Aug 28, 2018 at 01:03:26PM +0900, Masashi Honma wrote:
> On 2018/08/28 06:28, peter.oh@bowerswilkins.com wrote:
> >From: Peter Oh <peter.oh@bowerswilkins.com>
> >* v8: fixed failed test cases in wpas_mesh.
> >       re-introduce a pri/sec channel swap patch
> 
> Thank you, this patch passes existing mesh test cases on my environment
> also.
> 
> I expect this patch provides DFS-CAC-START and DFS-CAC-COMPLETED events.
> To check that, I created a my test case (mesh_dfs_test.patch).
> I could see DFS-CAC-START. But I saw a DFS_CAC_ABORTED event instead of
> DFS-CAC-COMPLETED events. Log file is 1535428477.tar.xz.
> 
> Could you provide working test case if possible ?

I did not see any response to this request. I don't think I would be
accepting the final patches to enable DFS with mesh without seeing a
hwsim test case that actually covers this functionality properly.
Peter Oh Jan. 10, 2019, 5:51 p.m. UTC | #4
On 01/03/2019 05:44 AM, Jouni Malinen wrote:
> On Tue, Aug 28, 2018 at 01:03:26PM +0900, Masashi Honma wrote:
>> On 2018/08/28 06:28, peter.oh@bowerswilkins.com wrote:
>>> From: Peter Oh <peter.oh@bowerswilkins.com>
>>> * v8: fixed failed test cases in wpas_mesh.
>>>        re-introduce a pri/sec channel swap patch
>> Thank you, this patch passes existing mesh test cases on my environment
>> also.
>>
>> I expect this patch provides DFS-CAC-START and DFS-CAC-COMPLETED events.
>> To check that, I created a my test case (mesh_dfs_test.patch).
>> I could see DFS-CAC-START. But I saw a DFS_CAC_ABORTED event instead of
>> DFS-CAC-COMPLETED events. Log file is 1535428477.tar.xz.
>>
>> Could you provide working test case if possible ?
> I did not see any response to this request. I don't think I would be
> accepting the final patches to enable DFS with mesh without seeing a
> hwsim test case that actually covers this functionality properly.
>
I wasn't noticed there was a feedback.
I'll try to follow-up when I have time.
Also thank you for your comments on other patches.

Peter
Peter Oh May 15, 2019, midnight UTC | #5
On 08/27/2018 09:03 PM, Masashi Honma wrote:
> On 2018/08/28 06:28, peter.oh@bowerswilkins.com wrote:
>> From: Peter Oh <peter.oh@bowerswilkins.com>
>> * v8: fixed failed test cases in wpas_mesh.
>>        re-introduce a pri/sec channel swap patch
>
> Thank you, this patch passes existing mesh test cases on my 
> environment also.
>
> I expect this patch provides DFS-CAC-START and DFS-CAC-COMPLETED events.
> To check that, I created a my test case (mesh_dfs_test.patch).
> I could see DFS-CAC-START. But I saw a DFS_CAC_ABORTED event instead 
> of DFS-CAC-COMPLETED events. Log file is 1535428477.tar.xz.
>
It's been long time to resume this work. :-)
According to your log, your mac80211 driver(should be from 
mac80211_hwsim) reported radar detection event, 
NL80211_CMD_RADAR_DETECT, with CAC_ABORT event hence the mesh interface 
aborted CAC which is correct behavior. To debug this, we need to look in 
mac80211_hwsim.c which is out of scope of this patch series.
> Could you provide working test case if possible ?
>
I'll give a try after working on the new patch series.

Thanks,
Peter
Thomas Pedersen May 15, 2019, 12:19 a.m. UTC | #6
On Mon, Aug 27, 2018 at 9:03 PM Masashi Honma <masashi.honma@gmail.com> wrote:
>
> On 2018/08/28 06:28, peter.oh@bowerswilkins.com wrote:
> > From: Peter Oh <peter.oh@bowerswilkins.com>
> > * v8: fixed failed test cases in wpas_mesh.
> >        re-introduce a pri/sec channel swap patch
>
> Thank you, this patch passes existing mesh test cases on my environment
> also.
>
> I expect this patch provides DFS-CAC-START and DFS-CAC-COMPLETED events.
> To check that, I created a my test case (mesh_dfs_test.patch).
> I could see DFS-CAC-START. But I saw a DFS_CAC_ABORTED event instead of
> DFS-CAC-COMPLETED events. Log file is 1535428477.tar.xz.
>
> Could you provide working test case if possible ?

I think the problem is your DFS-CAC-COMPLETED timeout is 30s, while
CAC takes 60s :)

Changing the timeout to 70s lets the test fail later at
check_mesh_group_added(). Not sure if I resurrected the patches
properly.

Thomas
Thomas Pedersen May 15, 2019, 6:55 p.m. UTC | #7
Hi Masahi,

On Mon, Aug 27, 2018 at 9:03 PM Masashi Honma <masashi.honma@gmail.com> wrote:
>
> On 2018/08/28 06:28, peter.oh@bowerswilkins.com wrote:
> > From: Peter Oh <peter.oh@bowerswilkins.com>
> > * v8: fixed failed test cases in wpas_mesh.
> >        re-introduce a pri/sec channel swap patch
>
> Thank you, this patch passes existing mesh test cases on my environment
> also.
>
> I expect this patch provides DFS-CAC-START and DFS-CAC-COMPLETED events.
> To check that, I created a my test case (mesh_dfs_test.patch).
> I could see DFS-CAC-START. But I saw a DFS_CAC_ABORTED event instead of
> DFS-CAC-COMPLETED events. Log file is 1535428477.tar.xz.
>
> Could you provide working test case if possible ?

Your fixed up test passes as the below:

diff --git a/tests/hwsim/test_wpas_mesh.py b/tests/hwsim/test_wpas_mesh.py
index 8bd3557..445f32b 100644
--- a/tests/hwsim/test_wpas_mesh.py
+++ b/tests/hwsim/test_wpas_mesh.py
@@ -22,6 +22,8 @@ from test_ap_ht import set_world_reg
from test_sae import radiotap_build, start_monitor, stop_monitor, \
build_sae_commit, sae_rx_commit_token_req
from hwsim_utils import set_group_map
+from test_dfs import wait_dfs_event
+from test_p2p_channel import set_country

def check_mesh_support(dev, secure=False):
if "MESH" not in dev.get_capability("modes"):
@@ -2475,3 +2477,47 @@ def run_mesh_sae_anti_clogging(dev, apdev):
check_mesh_group_added(dev[2])
check_mesh_peer_connected(dev[2])
check_mesh_peer_connected(dev[0])
+
+def test_wpas_mesh_open_dfs(dev, apdev):
+    """wpa_supplicant open MESH network with DFS"""
+    try:
+        _test_wpas_mesh_open_dfs(dev, apdev)
+    finally:
+        set_country("00")
+
+def _test_wpas_mesh_open_dfs(dev, apdev):
+    set_country("US")
+    for i in range(0, 2):
+        dev[i].request("SET country US")
+        check_mesh_support(dev[i])
+        add_open_mesh_network(dev[i], freq="5260", basic_rates="60 120 240",
+                              disable_ht40=True)
+
+    for i in range(0, 2):
+        ev = wait_dfs_event(dev[i], "DFS-CAC-START", 5)
+        if "DFS-CAC-START" not in ev:
+            # For now, assume DFS is not supported by all kernel builds.
+            raise HwsimSkip("CAC did not start - assume not supported")
+
+        ev = wait_dfs_event(dev[i], "DFS-CAC-COMPLETED", 70)
+        if "success=1" not in ev:
+            raise Exception("CAC failed")
+        if "freq=5260" not in ev:
+            raise Exception("Unexpected DFS freq result")
+
+        # Check for mesh joined
+        check_mesh_group_added(dev[i])
+
+    # Check for peer connected
+    for i in range(0, 2):
+        check_mesh_peer_connected(dev[i])
+
+    # Test connectivity 0->1 and 1->0
+    hwsim_utils.test_connectivity(dev[0], dev[1])
+
+    dev[0].mesh_group_remove()
+    dev[1].mesh_group_remove()
+    check_mesh_group_removed(dev[0])
+    check_mesh_group_removed(dev[1])
+    dev[0].dump_monitor()
+    dev[1].dump_monitor()

--

This also needs a small change to move the MESH_GROUP_STARTED
notification to after wpa_drv_join_mesh().





--
thomas
Peter Oh May 15, 2019, 8:57 p.m. UTC | #8
On 01/03/2019 05:44 AM, Jouni Malinen wrote:
> On Tue, Aug 28, 2018 at 01:03:26PM +0900, Masashi Honma wrote:
>> On 2018/08/28 06:28, peter.oh@bowerswilkins.com wrote:
>>> From: Peter Oh <peter.oh@bowerswilkins.com>
>>> * v8: fixed failed test cases in wpas_mesh.
>>>        re-introduce a pri/sec channel swap patch
>> Thank you, this patch passes existing mesh test cases on my environment
>> also.
>>
>> I expect this patch provides DFS-CAC-START and DFS-CAC-COMPLETED events.
>> To check that, I created a my test case (mesh_dfs_test.patch).
>> I could see DFS-CAC-START. But I saw a DFS_CAC_ABORTED event instead of
>> DFS-CAC-COMPLETED events. Log file is 1535428477.tar.xz.
>>
>> Could you provide working test case if possible ?
> I did not see any response to this request. I don't think I would be
> accepting the final patches to enable DFS with mesh without seeing a
> hwsim test case that actually covers this functionality properly.
>
I've talked to Thomas and will include his changes + Masashi's test 
script with their credits as a part of new series on top of tip of tree.

Thanks,
Peter