diff mbox series

[1/4] package/wpa_supplicant: fixing "Invalid configuration line"

Message ID 20220527103335.1968203-2-angelo@amarulasolutions.com
State Superseded
Headers show
Series Better wifi handling | expand

Commit Message

Angelo Compagnucci May 27, 2022, 10:33 a.m. UTC
Default configuration file is wrong for the default compiling options.

Fixes:

Successfully initialized wpa_supplicant
Line 1: unknown global field 'ctrl_interface=/var/run/wpa_supplicant'.
Line 1: Invalid configuration line
'ctrl_interface=/var/run/wpa_supplicant'.
Failed to read or parse configuration '/etc/wpa_supplicant.conf'.

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
---
 package/wpa_supplicant/wpa_supplicant.conf | 1 -
 1 file changed, 1 deletion(-)

Comments

Thomas Petazzoni June 1, 2022, 7:21 p.m. UTC | #1
On Fri, 27 May 2022 12:33:32 +0200
Angelo Compagnucci <angelo@amarulasolutions.com> wrote:

> Default configuration file is wrong for the default compiling options.
> 
> Fixes:
> 
> Successfully initialized wpa_supplicant
> Line 1: unknown global field 'ctrl_interface=/var/run/wpa_supplicant'.
> Line 1: Invalid configuration line
> 'ctrl_interface=/var/run/wpa_supplicant'.
> Failed to read or parse configuration '/etc/wpa_supplicant.conf'.
> 
> Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>

Indeed, this option only makes sense when
BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE=y I suppose. However, in this
case, it makes sense a lot of sense to have this option in the config
file.

Should we have some kind of logic to add this line when
BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE=y ?

Maybe something like this:

# ctrl_interface=/var/run/wpa_supplicant # BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE

and a bit of $(SED) magic in the .mk file ?

Best regards,

Thomas
Angelo Compagnucci June 1, 2022, 9:55 p.m. UTC | #2
On Wed, Jun 1, 2022 at 9:21 PM Thomas Petazzoni <
thomas.petazzoni@bootlin.com> wrote:

> On Fri, 27 May 2022 12:33:32 +0200
> Angelo Compagnucci <angelo@amarulasolutions.com> wrote:
>
> > Default configuration file is wrong for the default compiling options.
> >
> > Fixes:
> >
> > Successfully initialized wpa_supplicant
> > Line 1: unknown global field 'ctrl_interface=/var/run/wpa_supplicant'.
> > Line 1: Invalid configuration line
> > 'ctrl_interface=/var/run/wpa_supplicant'.
> > Failed to read or parse configuration '/etc/wpa_supplicant.conf'.
> >
> > Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
>
> Indeed, this option only makes sense when
> BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE=y I suppose. However, in this
> case, it makes sense a lot of sense to have this option in the config
> file.
>
> Should we have some kind of logic to add this line when
> BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE=y ?
>
> Maybe something like this:
>
> # ctrl_interface=/var/run/wpa_supplicant #
> BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE
>
> and a bit of $(SED) magic in the .mk file ?
>

No need to have this logic in my opinion:
* the option has a sensible default when enabled
* If a user really needs to change the default, he can add that line
manually in an overlay file.


>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com
>
Arnout Vandecappelle June 6, 2022, 12:42 p.m. UTC | #3
On 01/06/2022 23:55, Angelo Compagnucci wrote:
> 
> 
> On Wed, Jun 1, 2022 at 9:21 PM Thomas Petazzoni <thomas.petazzoni@bootlin.com 
> <mailto:thomas.petazzoni@bootlin.com>> wrote:
> 
>     On Fri, 27 May 2022 12:33:32 +0200
>     Angelo Compagnucci <angelo@amarulasolutions.com
>     <mailto:angelo@amarulasolutions.com>> wrote:
> 
>      > Default configuration file is wrong for the default compiling options.
>      >
>      > Fixes:
>      >
>      > Successfully initialized wpa_supplicant
>      > Line 1: unknown global field 'ctrl_interface=/var/run/wpa_supplicant'.
>      > Line 1: Invalid configuration line
>      > 'ctrl_interface=/var/run/wpa_supplicant'.
>      > Failed to read or parse configuration '/etc/wpa_supplicant.conf'.
>      >
>      > Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com
>     <mailto:angelo@amarulasolutions.com>>
> 
>     Indeed, this option only makes sense when
>     BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE=y I suppose. However, in this
>     case, it makes sense a lot of sense to have this option in the config
>     file.
> 
>     Should we have some kind of logic to add this line when
>     BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE=y ?
> 
>     Maybe something like this:
> 
>     # ctrl_interface=/var/run/wpa_supplicant # BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE
> 
>     and a bit of $(SED) magic in the .mk file ?
> 
> 
> No need to have this logic in my opinion:
> * the option has a sensible default when enabled

  Does it? AFAIK, if ctrl_interface is not specified in the config file or on 
the command line with -C, then no control socket will be created.

> * If a user really needs to change the default, he can add that line manually in 
> an overlay file.

  Yeah, but we prefer that if a user selects 
BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE, that the control socket actually appears 
in the expected place (/var/run/wpa_supplicant).

  Regards,
  Arnout

> 
> 
>     Best regards,
> 
>     Thomas
>     -- 
>     Thomas Petazzoni, co-owner and CEO, Bootlin
>     Embedded Linux and Kernel engineering and training
>     https://bootlin.com <https://bootlin.com>
> 
> 
> 
> -- 
> 
> Angelo Compagnucci
> 
> Software Engineer
> 
> angelo@amarulasolutions.com <mailto:angelo@amarulasolutions.com>
> __________________________________
> Amarula Solutions SRL
> 
> Via le Canevare 30, 31100 Treviso, Veneto, IT
> 
> T. +39 (0)42 243 5310
> info@amarulasolutions.com <mailto:info@amarulasolutions.com>
> 
> www.amarulasolutions.com <http://www.amarulasolutions.com/>
> 
> [`as] https://www.amarulasolutions.com <https://www.amarulasolutions.com>|
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
Angelo Compagnucci June 7, 2022, 10:21 a.m. UTC | #4
On Mon, Jun 6, 2022 at 2:42 PM Arnout Vandecappelle <arnout@mind.be> wrote:

>
>
> On 01/06/2022 23:55, Angelo Compagnucci wrote:
> >
> >
> > On Wed, Jun 1, 2022 at 9:21 PM Thomas Petazzoni <
> thomas.petazzoni@bootlin.com
> > <mailto:thomas.petazzoni@bootlin.com>> wrote:
> >
> >     On Fri, 27 May 2022 12:33:32 +0200
> >     Angelo Compagnucci <angelo@amarulasolutions.com
> >     <mailto:angelo@amarulasolutions.com>> wrote:
> >
> >      > Default configuration file is wrong for the default compiling
> options.
> >      >
> >      > Fixes:
> >      >
> >      > Successfully initialized wpa_supplicant
> >      > Line 1: unknown global field
> 'ctrl_interface=/var/run/wpa_supplicant'.
> >      > Line 1: Invalid configuration line
> >      > 'ctrl_interface=/var/run/wpa_supplicant'.
> >      > Failed to read or parse configuration '/etc/wpa_supplicant.conf'.
> >      >
> >      > Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com
> >     <mailto:angelo@amarulasolutions.com>>
> >
> >     Indeed, this option only makes sense when
> >     BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE=y I suppose. However, in this
> >     case, it makes sense a lot of sense to have this option in the config
> >     file.
> >
> >     Should we have some kind of logic to add this line when
> >     BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE=y ?
> >
> >     Maybe something like this:
> >
> >     # ctrl_interface=/var/run/wpa_supplicant #
> BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE
> >
> >     and a bit of $(SED) magic in the .mk file ?
> >
> >
> > No need to have this logic in my opinion:
> > * the option has a sensible default when enabled
>
>   Does it? AFAIK, if ctrl_interface is not specified in the config file or
> on
> the command line with -C, then no control socket will be created.
>
> > * If a user really needs to change the default, he can add that line
> manually in
> > an overlay file.
>
>   Yeah, but we prefer that if a user selects
> BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE, that the control socket actually
> appears
> in the expected place (/var/run/wpa_supplicant).
>

The problem here is that wpa_supplicant.conf file will always be provided
in a user overlay, because to connect to a wifi a proper `network=`
configuration settings must be provided.
Would we really like to mess with a user overlay provided configuration
file? I think that a user must ensure the configuration file is in good
shape for the service to work.


>
>   Regards,
>   Arnout
>
> >
> >
> >     Best regards,
> >
> >     Thomas
> >     --
> >     Thomas Petazzoni, co-owner and CEO, Bootlin
> >     Embedded Linux and Kernel engineering and training
> >     https://bootlin.com <https://bootlin.com>
> >
> >
> >
> > --
> >
> > Angelo Compagnucci
> >
> > Software Engineer
> >
> > angelo@amarulasolutions.com <mailto:angelo@amarulasolutions.com>
> > __________________________________
> > Amarula Solutions SRL
> >
> > Via le Canevare 30, 31100 Treviso, Veneto, IT
> >
> > T. +39 (0)42 243 5310
> > info@amarulasolutions.com <mailto:info@amarulasolutions.com>
> >
> > www.amarulasolutions.com <http://www.amarulasolutions.com/>
> >
> > [`as] https://www.amarulasolutions.com <https://www.amarulasolutions.com
> >|
> >
> > _______________________________________________
> > buildroot mailing list
> > buildroot@buildroot.org
> > https://lists.buildroot.org/mailman/listinfo/buildroot
>
Thomas Petazzoni June 7, 2022, 11:48 a.m. UTC | #5
On Tue, 7 Jun 2022 12:21:22 +0200
Angelo Compagnucci <angelo@amarulasolutions.com> wrote:

> The problem here is that wpa_supplicant.conf file will always be provided
> in a user overlay, because to connect to a wifi a proper `network=`
> configuration settings must be provided.

Then why do we provide an example configuration file? :-)

> Would we really like to mess with a user overlay provided configuration
> file? I think that a user must ensure the configuration file is in good
> shape for the service to work.

If the wpa_supplicant.conf provided by Buildroot is overridden by a
file in the rootfs overlay, then whatever we do in
WPA_SUPPLICANT_INSTALL_TARGET_HOOKS will have no effect, the file in
the rootfs overlay will win. So we are not "messing up" with the file
provided by the user.

Thomas
Angelo Compagnucci June 7, 2022, 12:16 p.m. UTC | #6
On Tue, Jun 7, 2022 at 1:48 PM Thomas Petazzoni <
thomas.petazzoni@bootlin.com> wrote:

> On Tue, 7 Jun 2022 12:21:22 +0200
> Angelo Compagnucci <angelo@amarulasolutions.com> wrote:
>
> > The problem here is that wpa_supplicant.conf file will always be provided
> > in a user overlay, because to connect to a wifi a proper `network=`
> > configuration settings must be provided.
>
> Then why do we provide an example configuration file? :-)
>

Is the one we provide really an example configuration file?  An example
configuration file usually looks quite different!


> > Would we really like to mess with a user overlay provided configuration
> > file? I think that a user must ensure the configuration file is in good
> > shape for the service to work.
>
> If the wpa_supplicant.conf provided by Buildroot is overridden by a
> file in the rootfs overlay, then whatever we do in
> WPA_SUPPLICANT_INSTALL_TARGET_HOOKS will have no effect, the file in
> the rootfs overlay will win. So we are not "messing up" with the file
> provided by the user.
>

Indeed. It looks useless doing some configuration file mangling only to
have it overwritten. We don't do that for other parameters, like autoscan
for example, which in turn we should do following this logic.
I think that the provided configuration file should work with provided
default options, or we should consider all the optional values too, they
are many more for wpa_supplicant. What happens if I configure EAP, or AP
mode or the hotspot? Should we have "example" configuration sections
enabled by those options?


> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com
>
Thomas Petazzoni June 7, 2022, 1:12 p.m. UTC | #7
On Tue, 7 Jun 2022 14:16:19 +0200
Angelo Compagnucci <angelo@amarulasolutions.com> wrote:

> > Then why do we provide an example configuration file? :-)
> 
> Is the one we provide really an example configuration file?  An example
> configuration file usually looks quite different!

Sorry I don't follow you. We provide and install
package/wpa_supplicant/wpa_supplicant.conf, which is an example
configuration.

Or perhaps your question was ironic/cynical, and I didn't get the joke?

> Indeed. It looks useless doing some configuration file mangling only to
> have it overwritten. We don't do that for other parameters, like autoscan
> for example, which in turn we should do following this logic.
> I think that the provided configuration file should work with provided
> default options, or we should consider all the optional values too, they
> are many more for wpa_supplicant. What happens if I configure EAP, or AP
> mode or the hotspot? Should we have "example" configuration sections
> enabled by those options?

I understand your point, and I agree it's difficult and probably too
complicated to have all the logic to adjust the example configuration
file to all possible sub-options of wpa_supplicant. We have to draw the
line somewhere and it's not very clear cut where to draw this line.

I just though a working wpa_cli / wpa_supplicant combo would be useful
to have as an out-of-the box experience when
BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE is enabled. I guess this was the
intention of the currently provided wpa_supplicant.conf.

Thomas
Angelo Compagnucci June 7, 2022, 1:22 p.m. UTC | #8
On Tue, Jun 7, 2022 at 3:12 PM Thomas Petazzoni <
thomas.petazzoni@bootlin.com> wrote:

> On Tue, 7 Jun 2022 14:16:19 +0200
> Angelo Compagnucci <angelo@amarulasolutions.com> wrote:
>
> > > Then why do we provide an example configuration file? :-)
> >
> > Is the one we provide really an example configuration file?  An example
> > configuration file usually looks quite different!
>
> Sorry I don't follow you. We provide and install
> package/wpa_supplicant/wpa_supplicant.conf, which is an example
> configuration.
>
> Or perhaps your question was ironic/cynical, and I didn't get the joke?
>

It was! Sorry! The example configuration file for wpa_supplicant is 2K+
line with explained each one of the configuration options.
Our is a highly opinionated minimal configuration file to run the service,
which in turn doesn't work due to an incompatible configuration line!


>
> > Indeed. It looks useless doing some configuration file mangling only to
> > have it overwritten. We don't do that for other parameters, like autoscan
> > for example, which in turn we should do following this logic.
> > I think that the provided configuration file should work with provided
> > default options, or we should consider all the optional values too, they
> > are many more for wpa_supplicant. What happens if I configure EAP, or AP
> > mode or the hotspot? Should we have "example" configuration sections
> > enabled by those options?
>
> I understand your point, and I agree it's difficult and probably too
> complicated to have all the logic to adjust the example configuration
> file to all possible sub-options of wpa_supplicant. We have to draw the
> line somewhere and it's not very clear cut where to draw this line.
>
> I just though a working wpa_cli / wpa_supplicant combo would be useful
> to have as an out-of-the box experience when
> BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE is enabled. I guess this was the
> intention of the currently provided wpa_supplicant.conf.
>

It could, but the outcome was poor, due to the fact the configuration
option kills the service with an error.
I still think we should stick with something that works for our default and
minimal configuration and let the user decide what to do.
I think it's cleaner to have a service that works "out of the box" and
complains with an error when you enable some options not properly
configured.


>
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com
>
diff mbox series

Patch

diff --git a/package/wpa_supplicant/wpa_supplicant.conf b/package/wpa_supplicant/wpa_supplicant.conf
index 1994a6c739..f8a73d465f 100644
--- a/package/wpa_supplicant/wpa_supplicant.conf
+++ b/package/wpa_supplicant/wpa_supplicant.conf
@@ -1,4 +1,3 @@ 
-ctrl_interface=/var/run/wpa_supplicant
 ap_scan=1
 
 network={