All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v4 1/3] package/wpa_supplicant: fixing "Invalid configuration line"
@ 2022-06-12 22:07 Angelo Compagnucci
  2022-06-12 22:07 ` [Buildroot] [PATCH v4 2/3] package/wpa_supplicant: adding ifupdown support Angelo Compagnucci
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Angelo Compagnucci @ 2022-06-12 22:07 UTC (permalink / raw)
  To: buildroot; +Cc: Angelo Compagnucci

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>
---
v1 -> v4:
* Enabling the ctrl_interface option when the config option is enabled

 package/wpa_supplicant/wpa_supplicant.conf | 2 +-
 package/wpa_supplicant/wpa_supplicant.mk   | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/package/wpa_supplicant/wpa_supplicant.conf b/package/wpa_supplicant/wpa_supplicant.conf
index 1994a6c739..20e9f7f842 100644
--- a/package/wpa_supplicant/wpa_supplicant.conf
+++ b/package/wpa_supplicant/wpa_supplicant.conf
@@ -1,4 +1,4 @@
-ctrl_interface=/var/run/wpa_supplicant
+#ctrl_interface=/var/run/wpa_supplicant
 ap_scan=1
 
 network={
diff --git a/package/wpa_supplicant/wpa_supplicant.mk b/package/wpa_supplicant/wpa_supplicant.mk
index c4cfe03371..14f6a6e271 100644
--- a/package/wpa_supplicant/wpa_supplicant.mk
+++ b/package/wpa_supplicant/wpa_supplicant.mk
@@ -184,6 +184,12 @@ WPA_SUPPLICANT_DEPENDENCIES += readline
 WPA_SUPPLICANT_CONFIG_ENABLE += CONFIG_READLINE
 endif
 
+ifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE),y)
+define WPA_SUPPLICANT_ENABLE_CTRL_IFACE
+	sed -i '/ctrl_interface/s/^#//g' $(TARGET_DIR)/etc/wpa_supplicant.conf
+endef
+endif
+
 ifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_WPA_CLIENT_SO),y)
 WPA_SUPPLICANT_CONFIG_ENABLE += CONFIG_BUILD_WPA_CLIENT_SO
 define WPA_SUPPLICANT_INSTALL_WPA_CLIENT_SO
@@ -259,6 +265,7 @@ define WPA_SUPPLICANT_INSTALL_TARGET_CMDS
 	$(WPA_SUPPLICANT_INSTALL_PASSPHRASE)
 	$(WPA_SUPPLICANT_INSTALL_DBUS)
 	$(WPA_SUPPLICANT_INSTALL_WPA_CLIENT_SO)
+	$(WPA_SUPPLICANT_ENABLE_CTRL_IFACE)
 endef
 
 define WPA_SUPPLICANT_INSTALL_INIT_SYSTEMD
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v4 2/3] package/wpa_supplicant: adding ifupdown support
  2022-06-12 22:07 [Buildroot] [PATCH v4 1/3] package/wpa_supplicant: fixing "Invalid configuration line" Angelo Compagnucci
@ 2022-06-12 22:07 ` Angelo Compagnucci
  2022-06-12 22:07 ` [Buildroot] [PATCH v4 3/3] package/busybox: make udhcp discover faster Angelo Compagnucci
  2022-06-19 15:42 ` [Buildroot] [PATCH v4 1/3] package/wpa_supplicant: fixing "Invalid configuration line" Arnout Vandecappelle
  2 siblings, 0 replies; 5+ messages in thread
From: Angelo Compagnucci @ 2022-06-12 22:07 UTC (permalink / raw)
  To: buildroot; +Cc: Angelo Compagnucci

Actually, configuring a wifi interface as per "interfaces" man:

auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant.conf

doesn't work on buildroot because the line wpa-conf is ignored due to
the lack of a proper ifupdown script to handle the wpa_supplicant
initialization.

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
Reviewed-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
---
v1 -> v2:
* Simplify script to the minimum to have the service started (Thomas,
  Nicolas)
v2 -> v3:
* Move IF_WPA_CONF check early (Nicolas)

 package/wpa_supplicant/ifupdown.sh       | 49 ++++++++++++++++++++++++
 package/wpa_supplicant/wpa_supplicant.mk |  9 +++++
 2 files changed, 58 insertions(+)
 create mode 100755 package/wpa_supplicant/ifupdown.sh

diff --git a/package/wpa_supplicant/ifupdown.sh b/package/wpa_supplicant/ifupdown.sh
new file mode 100755
index 0000000000..569344b683
--- /dev/null
+++ b/package/wpa_supplicant/ifupdown.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+# This file is executed by ifupdown in pre-up, post-up, pre-down and
+# post-down phases of network interface configuration.
+
+WPA_SUP_BIN="/usr/sbin/wpa_supplicant"
+
+# run this script only for interfaces which have wpa-conf option
+[ -z "$IF_WPA_CONF" ] && exit 0
+
+# Allow wpa_supplicant interface to be specified via wpa-iface
+# useful for starting wpa_supplicant on one interface of a bridge
+if [ -n "$IF_WPA_IFACE" ]; then
+	WPA_IFACE="$IF_WPA_IFACE"
+else
+	WPA_IFACE="$IFACE"
+fi
+
+WPA_SUP_PIDFILE="/run/wpa_supplicant.${WPA_IFACE}.pid"
+
+do_start () {
+	if [ ! -s "$IF_WPA_CONF" ]; then
+		echo "cannot read contents of $IF_WPA_CONF"
+		exit 1
+	fi
+	WPA_SUP_CONF="-c $IF_WPA_CONF"
+}
+
+case "$MODE" in
+	start)
+		do_start
+		case "$PHASE" in
+			post-up)
+				start-stop-daemon -S -q -x ${WPA_SUP_BIN} \
+				-- -B -i ${WPA_IFACE} ${WPA_SUP_CONF} -P ${WPA_SUP_PIDFILE}
+				;;
+		esac
+		;;
+
+	stop)
+		case "$PHASE" in
+			pre-down)
+				start-stop-daemon -K -p ${WPA_SUP_PIDFILE}
+				;;
+		esac
+		;;
+esac
+
+exit 0
diff --git a/package/wpa_supplicant/wpa_supplicant.mk b/package/wpa_supplicant/wpa_supplicant.mk
index 14f6a6e271..afcd6502e3 100644
--- a/package/wpa_supplicant/wpa_supplicant.mk
+++ b/package/wpa_supplicant/wpa_supplicant.mk
@@ -256,6 +256,14 @@ define WPA_SUPPLICANT_INSTALL_STAGING_CMDS
 	$(WPA_SUPPLICANT_INSTALL_STAGING_WPA_CLIENT_SO)
 endef
 
+ifeq ($(BR2_PACKAGE_IFUPDOWN_SCRIPTS),y)
+define WPA_SUPPLICANT_INSTALL_IFUP_SCRIPTS
+	$(INSTALL) -m 0755 -D package/wpa_supplicant/ifupdown.sh \
+		$(TARGET_DIR)/etc/network/if-up.d/wpasupplicant
+	ln -sf ../if-up.d/wpasupplicant $(TARGET_DIR)/etc/network/if-down.d/wpasupplicant
+endef
+endif
+
 define WPA_SUPPLICANT_INSTALL_TARGET_CMDS
 	$(INSTALL) -m 0755 -D $(@D)/$(WPA_SUPPLICANT_SUBDIR)/wpa_supplicant \
 		$(TARGET_DIR)/usr/sbin/wpa_supplicant
@@ -265,6 +273,7 @@ define WPA_SUPPLICANT_INSTALL_TARGET_CMDS
 	$(WPA_SUPPLICANT_INSTALL_PASSPHRASE)
 	$(WPA_SUPPLICANT_INSTALL_DBUS)
 	$(WPA_SUPPLICANT_INSTALL_WPA_CLIENT_SO)
+	$(WPA_SUPPLICANT_INSTALL_IFUP_SCRIPTS)
 	$(WPA_SUPPLICANT_ENABLE_CTRL_IFACE)
 endef
 
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v4 3/3] package/busybox: make udhcp discover faster
  2022-06-12 22:07 [Buildroot] [PATCH v4 1/3] package/wpa_supplicant: fixing "Invalid configuration line" Angelo Compagnucci
  2022-06-12 22:07 ` [Buildroot] [PATCH v4 2/3] package/wpa_supplicant: adding ifupdown support Angelo Compagnucci
@ 2022-06-12 22:07 ` Angelo Compagnucci
  2022-06-19 15:42 ` [Buildroot] [PATCH v4 1/3] package/wpa_supplicant: fixing "Invalid configuration line" Arnout Vandecappelle
  2 siblings, 0 replies; 5+ messages in thread
From: Angelo Compagnucci @ 2022-06-12 22:07 UTC (permalink / raw)
  To: buildroot; +Cc: Thomas Petazzoni, Angelo Compagnucci

Instead of waiting almost 10 seconds foreground (3 discovery packets for
3 seconds retry delay) at each boot, make only one request then fork to
background. This way, the behavior is the same for working interfaces,
but it's way faster for interfaces where the address cannot be obtained
straight away.

Acked-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
---
 package/busybox/busybox.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/busybox/busybox.config b/package/busybox/busybox.config
index 52cb8ffcd8..2409cbcce1 100644
--- a/package/busybox/busybox.config
+++ b/package/busybox/busybox.config
@@ -1022,7 +1022,7 @@ CONFIG_UDHCP_DEBUG=0
 CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
 CONFIG_FEATURE_UDHCP_RFC3397=y
 CONFIG_FEATURE_UDHCP_8021Q=y
-CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-b -R -O search"
+CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-t1 -b -R -O search"
 
 #
 # Print Utilities
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH v4 1/3] package/wpa_supplicant: fixing "Invalid configuration line"
  2022-06-12 22:07 [Buildroot] [PATCH v4 1/3] package/wpa_supplicant: fixing "Invalid configuration line" Angelo Compagnucci
  2022-06-12 22:07 ` [Buildroot] [PATCH v4 2/3] package/wpa_supplicant: adding ifupdown support Angelo Compagnucci
  2022-06-12 22:07 ` [Buildroot] [PATCH v4 3/3] package/busybox: make udhcp discover faster Angelo Compagnucci
@ 2022-06-19 15:42 ` Arnout Vandecappelle
  2022-07-19 16:10   ` Peter Korsgaard
  2 siblings, 1 reply; 5+ messages in thread
From: Arnout Vandecappelle @ 2022-06-19 15:42 UTC (permalink / raw)
  To: Angelo Compagnucci, buildroot



On 13/06/2022 00:07, Angelo Compagnucci 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>

  Applied series to master, thanks.

  Regards,
  Arnout

> ---
> v1 -> v4:
> * Enabling the ctrl_interface option when the config option is enabled
> 
>   package/wpa_supplicant/wpa_supplicant.conf | 2 +-
>   package/wpa_supplicant/wpa_supplicant.mk   | 7 +++++++
>   2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/package/wpa_supplicant/wpa_supplicant.conf b/package/wpa_supplicant/wpa_supplicant.conf
> index 1994a6c739..20e9f7f842 100644
> --- a/package/wpa_supplicant/wpa_supplicant.conf
> +++ b/package/wpa_supplicant/wpa_supplicant.conf
> @@ -1,4 +1,4 @@
> -ctrl_interface=/var/run/wpa_supplicant
> +#ctrl_interface=/var/run/wpa_supplicant
>   ap_scan=1
>   
>   network={
> diff --git a/package/wpa_supplicant/wpa_supplicant.mk b/package/wpa_supplicant/wpa_supplicant.mk
> index c4cfe03371..14f6a6e271 100644
> --- a/package/wpa_supplicant/wpa_supplicant.mk
> +++ b/package/wpa_supplicant/wpa_supplicant.mk
> @@ -184,6 +184,12 @@ WPA_SUPPLICANT_DEPENDENCIES += readline
>   WPA_SUPPLICANT_CONFIG_ENABLE += CONFIG_READLINE
>   endif
>   
> +ifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE),y)
> +define WPA_SUPPLICANT_ENABLE_CTRL_IFACE
> +	sed -i '/ctrl_interface/s/^#//g' $(TARGET_DIR)/etc/wpa_supplicant.conf
> +endef
> +endif
> +
>   ifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_WPA_CLIENT_SO),y)
>   WPA_SUPPLICANT_CONFIG_ENABLE += CONFIG_BUILD_WPA_CLIENT_SO
>   define WPA_SUPPLICANT_INSTALL_WPA_CLIENT_SO
> @@ -259,6 +265,7 @@ define WPA_SUPPLICANT_INSTALL_TARGET_CMDS
>   	$(WPA_SUPPLICANT_INSTALL_PASSPHRASE)
>   	$(WPA_SUPPLICANT_INSTALL_DBUS)
>   	$(WPA_SUPPLICANT_INSTALL_WPA_CLIENT_SO)
> +	$(WPA_SUPPLICANT_ENABLE_CTRL_IFACE)
>   endef
>   
>   define WPA_SUPPLICANT_INSTALL_INIT_SYSTEMD
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH v4 1/3] package/wpa_supplicant: fixing "Invalid configuration line"
  2022-06-19 15:42 ` [Buildroot] [PATCH v4 1/3] package/wpa_supplicant: fixing "Invalid configuration line" Arnout Vandecappelle
@ 2022-07-19 16:10   ` Peter Korsgaard
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2022-07-19 16:10 UTC (permalink / raw)
  To: Arnout Vandecappelle; +Cc: buildroot, Angelo Compagnucci

>>>>> "Arnout" == Arnout Vandecappelle <arnout@mind.be> writes:

 > On 13/06/2022 00:07, Angelo Compagnucci 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>

Committed to 2022.05.x and 2022.02.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-07-19 16:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-12 22:07 [Buildroot] [PATCH v4 1/3] package/wpa_supplicant: fixing "Invalid configuration line" Angelo Compagnucci
2022-06-12 22:07 ` [Buildroot] [PATCH v4 2/3] package/wpa_supplicant: adding ifupdown support Angelo Compagnucci
2022-06-12 22:07 ` [Buildroot] [PATCH v4 3/3] package/busybox: make udhcp discover faster Angelo Compagnucci
2022-06-19 15:42 ` [Buildroot] [PATCH v4 1/3] package/wpa_supplicant: fixing "Invalid configuration line" Arnout Vandecappelle
2022-07-19 16:10   ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.