diff mbox series

[OpenWrt-Devel] mac80211: pass hostapd control socket to mesh-mode supplicant

Message ID 20180412234125.GA28076@makrotopia.org
State Accepted
Headers show
Series [OpenWrt-Devel] mac80211: pass hostapd control socket to mesh-mode supplicant | expand

Commit Message

Daniel Golle April 12, 2018, 11:41 p.m. UTC
Unlike when operating in Ad-Hoc mode, we apparently need to pass the
hostapd control socket interface to wpa_supplicant when using 802.11s
mesh mode.

There also seems to still be something wrong with the logic setting
channel and (v)htmode parameters when using AP + mesh...

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sven Eckelmann April 13, 2018, 9:34 a.m. UTC | #1
On Freitag, 13. April 2018 01:41:31 CEST Daniel Golle wrote:
> Unlike when operating in Ad-Hoc mode, we apparently need to pass the
> hostapd control socket interface to wpa_supplicant when using 802.11s
> mesh mode.
> 
> There also seems to still be something wrong with the logic setting
> channel and (v)htmode parameters when using AP + mesh...

I haven't tested the current state but this was basically breaking encrypted 
mesh + AP (AP never came up). Problem was the code (OpenWrt specific) in 
wpa_supplicant which called STOP_AP via this socket.

Kind regards,
	Sven
Felix Fietkau April 13, 2018, 9:37 a.m. UTC | #2
On 2018-04-13 11:34, Sven Eckelmann wrote:
> On Freitag, 13. April 2018 01:41:31 CEST Daniel Golle wrote:
>> Unlike when operating in Ad-Hoc mode, we apparently need to pass the
>> hostapd control socket interface to wpa_supplicant when using 802.11s
>> mesh mode.
>> 
>> There also seems to still be something wrong with the logic setting
>> channel and (v)htmode parameters when using AP + mesh...
> 
> I haven't tested the current state but this was basically breaking encrypted 
> mesh + AP (AP never came up). Problem was the code (OpenWrt specific) in 
> wpa_supplicant which called STOP_AP via this socket.
The control socket code was written for AP+Client. It usually calls
STOP_AP before it attempts a new scan + assoc. When the interface is
connected again, it starts the AP again on the new operating frequency.
I don't think the problem is STOP_AP itself, I think the problem is the
lack of a start call when the mesh interface is set up properly.

- Felix
Daniel Danzberger April 19, 2018, 10:52 a.m. UTC | #3
This patch breaks encrypted mesh mode.

I agree, there is still something wrong with the logic when using encrypted mesh.
Also the setting of the mesh parameters fails, because nl80211_mesh_join must
happen before nl80211_update_mesh_config. This results in these errors:
---
netifd: radio1 (6314): command failed: Link has been severed (-67)
---
Originating from net/wireless/nl80211.c:nl80211_update_mesh_config():6133
through calling in 'iw set mesh_params' at /lib/netifd/wireless/mac80211.sh:678

When using mesh without encryption this is not an issue, because
'iw mesh_join' is called before 'iw set mesh_params'
in '/lib/netifd/wireless/mac80211.sh:678

With encryption the setting of the parameters need to happen after
wpa_supplicant triggered nl80211_mesh_join.

But I don't know how to solve this properly yet either...

On 04/13/2018 01:41 AM, Daniel Golle wrote:
> Unlike when operating in Ad-Hoc mode, we apparently need to pass the
> hostapd control socket interface to wpa_supplicant when using 802.11s
> mesh mode.
> 
> There also seems to still be something wrong with the logic setting
> channel and (v)htmode parameters when using AP + mesh...
> 
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> ---
>  package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
> index bf9d52ae42..3a1d475a5c 100644
> --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
> +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
> @@ -633,7 +633,7 @@ mac80211_setup_vif() {
>  			if [ -n "$key" ]; then
>  				wireless_vif_parse_encryption
>  				freq="$(get_freq "$phy" "$channel")"
> -				mac80211_setup_supplicant_noctl || failed=1
> +				mac80211_setup_supplicant || failed=1
>  			else
>  				json_get_vars mesh_id mcast_rate
>  
>
Daniel Golle April 19, 2018, 11:04 a.m. UTC | #4
Hi Daniel

On Thu, Apr 19, 2018 at 12:52:56PM +0200, daniel wrote:
> This patch breaks encrypted mesh mode.

Yes, I reverted it yesterday afternoon...

> 
> I agree, there is still something wrong with the logic when using encrypted mesh.

Yes, and that's on my agenda for tonight (fixing /lib/netifd/wireless/mac80211.sh)

> Also the setting of the mesh parameters fails, because nl80211_mesh_join must
> happen before nl80211_update_mesh_config. This results in these errors:
> ---
> netifd: radio1 (6314): command failed: Link has been severed (-67)
> ---
> Originating from net/wireless/nl80211.c:nl80211_update_mesh_config():6133
> through calling in 'iw set mesh_params' at /lib/netifd/wireless/mac80211.sh:678
> 
> When using mesh without encryption this is not an issue, because
> 'iw mesh_join' is called before 'iw set mesh_params'
> in '/lib/netifd/wireless/mac80211.sh:678
> 
> With encryption the setting of the parameters need to happen after
> wpa_supplicant triggered nl80211_mesh_join.
> 
> But I don't know how to solve this properly yet either...

Making wpa_supplicant set the mesh parameters (it already does that,
but uses non-configurable default values). I added support to at least
handle mesh_fwding, because it was what I needed for my use-case, see

https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=ff8df2b3f9c161edc3ab543bdbeb04a9fb45c959


Cheers


Daniel

> 
> On 04/13/2018 01:41 AM, Daniel Golle wrote:
> > Unlike when operating in Ad-Hoc mode, we apparently need to pass the
> > hostapd control socket interface to wpa_supplicant when using 802.11s
> > mesh mode.
> > 
> > There also seems to still be something wrong with the logic setting
> > channel and (v)htmode parameters when using AP + mesh...
> > 
> > Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> > ---
> >  package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
> > index bf9d52ae42..3a1d475a5c 100644
> > --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
> > +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
> > @@ -633,7 +633,7 @@ mac80211_setup_vif() {
> >  			if [ -n "$key" ]; then
> >  				wireless_vif_parse_encryption
> >  				freq="$(get_freq "$phy" "$channel")"
> > -				mac80211_setup_supplicant_noctl || failed=1
> > +				mac80211_setup_supplicant || failed=1
> >  			else
> >  				json_get_vars mesh_id mcast_rate
> >  
> > 
> 
> -- 
> Regards
> 
> Daniel Danzberger
> embeDD GmbH, Alter Postplatz 2, CH-6370 Stans
> 
> _______________________________________________
> Lede-dev mailing list
> Lede-dev@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev
Daniel Hernandez June 4, 2018, 1:17 p.m. UTC | #5
Hello 

Any clue if these fixes are going to make it into Openwrt / LEDE  18.06 . So I can begin testing. 

Thanks,
Danny

-----Original Message-----
From: Sven Eckelmann [mailto:sven.eckelmann@openmesh.com] 
Sent: Friday, April 13, 2018 4:34 AM
To: openwrt-devel@lists.openwrt.org
Cc: Daniel Golle <daniel@makrotopia.org>; lede-dev@lists.infradead.org; Daniel Hernandez <d.hernandez@cititechs.com>
Subject: Re: [OpenWrt-Devel] [PATCH] mac80211: pass hostapd control socket to mesh-mode supplicant

On Freitag, 13. April 2018 01:41:31 CEST Daniel Golle wrote:
> Unlike when operating in Ad-Hoc mode, we apparently need to pass the 
> hostapd control socket interface to wpa_supplicant when using 802.11s 
> mesh mode.
> 
> There also seems to still be something wrong with the logic setting 
> channel and (v)htmode parameters when using AP + mesh...

I haven't tested the current state but this was basically breaking encrypted mesh + AP (AP never came up). Problem was the code (OpenWrt specific) in wpa_supplicant which called STOP_AP via this socket.

Kind regards,
	Sven
Sven Eckelmann June 4, 2018, 1:19 p.m. UTC | #6
On Montag, 4. Juni 2018 13:17:10 CEST Daniel Hernandez wrote:
> Hello 
> 
> Any clue if these fixes are going to make it into Openwrt / LEDE  18.06 . So I can begin testing. 

They are part of openwrt-18.06-snapshot.

Kind regards,
	Sven
Daniel Hernandez June 5, 2018, 5:50 p.m. UTC | #7
So some quick feedback on the snapshot from yesterday . It seems to work  I uninstall wpad-mini and in the new version I installed. wpad-mesh-openssl



I noticed this Stack Dump via Serial port however its brief and seems to still work.



[cid:image001.png@01D3FCCB.CECB58B0]



-----Original Message-----
From: Sven Eckelmann [mailto:sven.eckelmann@openmesh.com]
Sent: Monday, June 4, 2018 8:19 AM
To: Daniel Hernandez <d.hernandez@cititechs.com>
Cc: openwrt-devel@lists.openwrt.org; Daniel Golle <daniel@makrotopia.org>; lede-dev@lists.infradead.org
Subject: Re: [OpenWrt-Devel] [PATCH] mac80211: pass hostapd control socket to mesh-mode supplicant



On Montag, 4. Juni 2018 13:17:10 CEST Daniel Hernandez wrote:

> Hello

>

> Any clue if these fixes are going to make it into Openwrt / LEDE  18.06 . So I can begin testing.



They are part of openwrt-18.06-snapshot.



Kind regards,

                Sven
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:#954F72;
	text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
	{mso-style-priority:99;
	mso-style-link:"Plain Text Char";
	margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
span.PlainTextChar
	{mso-style-name:"Plain Text Char";
	mso-style-priority:99;
	mso-style-link:"Plain Text";
	font-family:"Calibri",sans-serif;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri",sans-serif;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoPlainText">So some quick feedback on the snapshot from yesterday . It seems to work &nbsp;I uninstall wpad-mini and in the new version I installed. wpad-mesh-openssl<o:p></o:p></p>
<p class="MsoPlainText"><o:p>&nbsp;</o:p></p>
<p class="MsoPlainText">I noticed this Stack Dump via Serial port however its brief and seems to still work.
<o:p></o:p></p>
<p class="MsoPlainText"><o:p>&nbsp;</o:p></p>
<p class="MsoPlainText"><img width="1266" height="357" style="width:13.1875in;height:3.7187in" id="Picture_x0020_1" src="cid:image001.png@01D3FCCB.CECB58B0"><o:p></o:p></p>
<p class="MsoPlainText"><a name="_MailEndCompose"><o:p>&nbsp;</o:p></a></p>
<span style="mso-bookmark:_MailEndCompose"></span>
<p class="MsoPlainText">-----Original Message-----<br>
From: Sven Eckelmann [mailto:sven.eckelmann@openmesh.com] <br>
Sent: Monday, June 4, 2018 8:19 AM<br>
To: Daniel Hernandez &lt;d.hernandez@cititechs.com&gt;<br>
Cc: openwrt-devel@lists.openwrt.org; Daniel Golle &lt;daniel@makrotopia.org&gt;; lede-dev@lists.infradead.org<br>
Subject: Re: [OpenWrt-Devel] [PATCH] mac80211: pass hostapd control socket to mesh-mode supplicant</p>
<p class="MsoPlainText"><o:p>&nbsp;</o:p></p>
<p class="MsoPlainText">On Montag, 4. Juni 2018 13:17:10 CEST Daniel Hernandez wrote:<o:p></o:p></p>
<p class="MsoPlainText">&gt; Hello <o:p></o:p></p>
<p class="MsoPlainText">&gt; <o:p></o:p></p>
<p class="MsoPlainText">&gt; Any clue if these fixes are going to make it into Openwrt / LEDE&nbsp; 18.06 . So I can begin testing.
<o:p></o:p></p>
<p class="MsoPlainText"><o:p>&nbsp;</o:p></p>
<p class="MsoPlainText">They are part of openwrt-18.06-snapshot.<o:p></o:p></p>
<p class="MsoPlainText"><o:p>&nbsp;</o:p></p>
<p class="MsoPlainText">Kind regards,<o:p></o:p></p>
<p class="MsoPlainText">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sven<o:p></o:p></p>
</div>
</body>
</html>
diff mbox series

Patch

diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
index bf9d52ae42..3a1d475a5c 100644
--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -633,7 +633,7 @@  mac80211_setup_vif() {
 			if [ -n "$key" ]; then
 				wireless_vif_parse_encryption
 				freq="$(get_freq "$phy" "$channel")"
-				mac80211_setup_supplicant_noctl || failed=1
+				mac80211_setup_supplicant || failed=1
 			else
 				json_get_vars mesh_id mcast_rate