Skip to contentSkip to conversation

package/connman: enable wireguard

PATCH New James Hilliard 4 participants 10 messages Mar 8, 2020 – Mar 26, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/connman: enable wireguard

We also need to select libmnl when building with wireguard support or with nftables.

---
 package/connman/Config.in  | 5 +++++
 package/connman/connman.mk | 9 ++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)
package/connman/Config.in +5 -0
index ac012dda54..614b826f96 100644
@@ -33,6 +33,7 @@ config BR2_PACKAGE_CONNMAN_NFTABLES
 	bool "nftables"
 	depends on BR2_USE_WCHAR
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12
+	select BR2_PACKAGE_LIBMNL
 	select BR2_PACKAGE_NFTABLES
 	help
 	  Use nftables as firewall.
@@ -51,6 +52,10 @@ config BR2_PACKAGE_CONNMAN_WIFI
 	  setup). ConnMan detects the start of wpa_supplicant
 	  automatically.
 
+config BR2_PACKAGE_CONNMAN_WIREGUARD
+	bool "enable wireguard support"
+	select BR2_PACKAGE_LIBMNL
+
 config BR2_PACKAGE_CONNMAN_WISPR
 	bool "enable WISPr support"
 	depends on !BR2_STATIC_LIBS # gnutls
package/connman/connman.mk +8 -1
index 701be8b59d..23e7cb7797 100644
@@ -41,7 +41,7 @@ CONNMAN_CONF_OPTS += --with-firewall=iptables
 CONNMAN_DEPENDENCIES += iptables
 else ifeq ($(BR2_PACKAGE_CONNMAN_NFTABLES),y)
 CONNMAN_CONF_OPTS += --with-firewall=nftables
-CONNMAN_DEPENDENCIES += nftables
+CONNMAN_DEPENDENCIES += libmnl nftables
 endif
 
 ifeq ($(BR2_PACKAGE_CONNMAN_LOOPBACK),y)
@@ -70,6 +70,13 @@ else
 CONNMAN_CONF_OPTS += --disable-wifi
 endif
 
+ifeq ($(BR2_PACKAGE_CONNMAN_WIREGUARD),y)
+CONNMAN_CONF_OPTS += --enable-wireguard
+CONNMAN_DEPENDENCIES += libmnl
+else
+CONNMAN_CONF_OPTS += --disable-wireguard
+endif
+
 ifeq ($(BR2_PACKAGE_CONNMAN_WISPR),y)
 CONNMAN_CONF_OPTS += --enable-wispr
 CONNMAN_DEPENDENCIES += gnutls
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 package/connman: enable wireguard

Hello,

Quoted 14 lines · On Sun, 8 Mar 2020 00:07:41 -0700 James Hilliard <[email protected]>…

We also need to select libmnl when building with wireguard support or with nftables.

---
 package/connman/Config.in  | 5 +++++
 package/connman/connman.mk | 9 ++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)
package/connman/Config.in +0 -0
index ac012dda54..614b826f96 100644

package/connman/Config.in config BR2_PACKAGE_CONNMAN_NFTABLES · line 36

Quoted 4 lines
package/connman/Config.in +1 -0
@@ -33,6 +33,7 @@ config BR2_PACKAGE_CONNMAN_NFTABLES
 	bool "nftables"
 	depends on BR2_USE_WCHAR
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12
+	select BR2_PACKAGE_LIBMNL

How is this related to wireguard support ?

package/connman/Config.in config BR2_PACKAGE_CONNMAN_WIFI · line 57

Quoted 10 lines
package/connman/Config.in +3 -0
 	select BR2_PACKAGE_NFTABLES
 	help
 	  Use nftables as firewall.
@@ -51,6 +52,10 @@ config BR2_PACKAGE_CONNMAN_WIFI
 	  setup). ConnMan detects the start of wpa_supplicant
 	  automatically.
 
+config BR2_PACKAGE_CONNMAN_WIREGUARD
+	bool "enable wireguard support"
+	select BR2_PACKAGE_LIBMNL

We already had a patch from Petr at
http://patchwork.ozlabs.org/patch/1246181/ to add Wireguard support, but he was also selecting BR2_PACKAGE_WIREGUARD_TOOLS.

Could you or Petr clarify this ?

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 package/connman: enable wireguard

Hi Thomas, James,

Quoted 12 lines
Quoted 8 lines · On Sun, 8 Mar 2020 00:07:41 -0700 James Hilliard <[email protected]>…

We also need to select libmnl when building with wireguard support or with nftables.

---
 package/connman/Config.in  | 5 +++++
 package/connman/connman.mk | 9 ++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)
Quoted 11 lines

package/connman/Config.in config BR2_PACKAGE_CONNMAN_NFTABLES · line 36

Quoted 9 lines
package/connman/Config.in +1 -0
index ac012dda54..614b826f96 100644
@@ -33,6 +33,7 @@ config BR2_PACKAGE_CONNMAN_NFTABLES
 	bool "nftables"
 	depends on BR2_USE_WCHAR
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12
+	select BR2_PACKAGE_LIBMNL

How is this related to wireguard support ?

Yes.

Quoted 15 lines

package/connman/Config.in config BR2_PACKAGE_CONNMAN_WIFI · line 57

Quoted 10 lines
package/connman/Config.in +3 -0
 	select BR2_PACKAGE_NFTABLES
 	help
 	  Use nftables as firewall.
@@ -51,6 +52,10 @@ config BR2_PACKAGE_CONNMAN_WIFI
 	  setup). ConnMan detects the start of wpa_supplicant
 	  automatically.
 
+config BR2_PACKAGE_CONNMAN_WIREGUARD
+	bool "enable wireguard support"
+	select BR2_PACKAGE_LIBMNL

We already had a patch from Petr at
http://patchwork.ozlabs.org/patch/1246181/ to add Wireguard support, but he was also selecting BR2_PACKAGE_WIREGUARD_TOOLS.

Quoted 1 line

Could you or Petr clarify this ?

configure.ac
found_libmnl="no"

if (test "${firewall_type}" = "nftables" -o \
		"${enable_wireguard}" != "no"); then
	PKG_CHECK_MODULES(LIBMNL, [libmnl >= 1.0.0], [found_libmnl="yes"],
		AC_MSG_ERROR([libmnl >= 1.0.0 not found]))
	AC_SUBST(LIBMNL_CFLAGS)
	AC_SUBST(LIBMNL_LIBS)

fi
AM_CONDITIONAL(LIBMNL, test "${found_libmnl}" != "no")

IMHO this means that libmnl is required for nftables and wireguard.

Kind regards,
Petr

#3 lore raw

PATCH 1/1 package/connman: enable wireguard

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Petr" == Petr Vorel <[email protected]> writes:

Hi,

Quoted 17 lines
Quoted 9 lines

package/connman/Config.in config BR2_PACKAGE_CONNMAN_WIFI · line 57

Quoted 3 lines
package/connman/Config.in +3 -0
+config BR2_PACKAGE_CONNMAN_WIREGUARD
+	bool "enable wireguard support"
+	select BR2_PACKAGE_LIBMNL

We already had a patch from Petr at
http://patchwork.ozlabs.org/patch/1246181/ to add Wireguard support, but he was also selecting BR2_PACKAGE_WIREGUARD_TOOLS.

Could you or Petr clarify this ?

configure.ac
found_libmnl="no"

if (test "${firewall_type}" = "nftables" -o \
		"${enable_wireguard}" != "no"); then
	PKG_CHECK_MODULES(LIBMNL, [libmnl >= 1.0.0], [found_libmnl="yes"],
		AC_MSG_ERROR([libmnl >= 1.0.0 not found]))
	AC_SUBST(LIBMNL_CFLAGS)
	AC_SUBST(LIBMNL_LIBS)
Quoted 4 lines

fi
AM_CONDITIONAL(LIBMNL, test "${found_libmnl}" != "no")

IMHO this means that libmnl is required for nftables and wireguard.

Yes. What about wireguard-tools? Are they used by connman or does it directly talk the netlink protocol? I guess the latter given the libmnl dependency?

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 1/1 package/connman: enable wireguard

Quoted 25 lines · Peter Korsgaard
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

"Petr" == Petr Vorel <[email protected]> writes:

Hi,

Quoted 19 lines
Quoted 9 lines
Quoted 3 lines

+config BR2_PACKAGE_CONNMAN_WIREGUARD
+ bool "enable wireguard support"
+ select BR2_PACKAGE_LIBMNL

We already had a patch from Petr at
http://patchwork.ozlabs.org/patch/1246181/ to add Wireguard support, but he was also selecting BR2_PACKAGE_WIREGUARD_TOOLS.

Could you or Petr clarify this ?

configure.ac
found_libmnl="no"

if (test "${firewall_type}" = "nftables" -o \
             "${enable_wireguard}" != "no"); then
     PKG_CHECK_MODULES(LIBMNL, [libmnl >= 1.0.0], [found_libmnl="yes"],
             AC_MSG_ERROR([libmnl >= 1.0.0 not found]))
     AC_SUBST(LIBMNL_CFLAGS)
     AC_SUBST(LIBMNL_LIBS)

fi
AM_CONDITIONAL(LIBMNL, test "${found_libmnl}" != "no")

Quoted 5 lines
Quoted 1 line

IMHO this means that libmnl is required for nftables and wireguard.

Yes. What about wireguard-tools? Are they used by connman or does it directly talk the netlink protocol? I guess the latter given the libmnl dependency?

Yeah, connman seemed to build fine with wireguard support without wireguard-tools.

Quoted 3 lines

--
Bye, Peter Korsgaard

#5 lore raw

PATCH 1/1 package/connman: enable wireguard

Quoted 28 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"James" == James Hilliard <[email protected]> writes:

Quoted 25 lines · Peter Korsgaard
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

"Petr" == Petr Vorel <[email protected]> writes:

Hi,

Quoted 19 lines
Quoted 9 lines
Quoted 3 lines

+config BR2_PACKAGE_CONNMAN_WIREGUARD
+ bool "enable wireguard support"
+ select BR2_PACKAGE_LIBMNL

We already had a patch from Petr at
http://patchwork.ozlabs.org/patch/1246181/ to add Wireguard support, but he was also selecting BR2_PACKAGE_WIREGUARD_TOOLS.

Could you or Petr clarify this ?

configure.ac
found_libmnl="no"

if (test "${firewall_type}" = "nftables" -o \
             "${enable_wireguard}" != "no"); then
     PKG_CHECK_MODULES(LIBMNL, [libmnl >= 1.0.0], [found_libmnl="yes"],
             AC_MSG_ERROR([libmnl >= 1.0.0 not found]))
     AC_SUBST(LIBMNL_CFLAGS)
     AC_SUBST(LIBMNL_LIBS)

fi
AM_CONDITIONAL(LIBMNL, test "${found_libmnl}" != "no")

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

IMHO this means that libmnl is required for nftables and wireguard.

Yes. What about wireguard-tools? Are they used by connman or does it directly talk the netlink protocol? I guess the latter given the libmnl dependency?

Yeah, connman seemed to build fine with wireguard support without wireguard-tools.

Well, a wireguard-tools dependency issue would probably be visible at runtime as it would then just call out to those binaries.

Looking at the code, I see that is not the case and connman directly talks the netlink interface of the kernel driver:

https://git.kernel.org/pub/scm/network/connman/connman.git/tree/vpn/plugins/libwireguard.c

Signature · 1 line
Bye, Peter Korsgaard
#6 lore raw

PATCH 1/1 package/connman: enable wireguard

In reply to Petr Vorel

Hello,

Quoted 31 lines · On Sun, 8 Mar 2020 18:37:18 +0100 Petr Vorel <[email protected]> wrote:
Quoted 11 lines

package/connman/Config.in config BR2_PACKAGE_CONNMAN_NFTABLES · line 36

Quoted 9 lines
package/connman/Config.in +1 -0
index ac012dda54..614b826f96 100644
@@ -33,6 +33,7 @@ config BR2_PACKAGE_CONNMAN_NFTABLES
 	bool "nftables"
 	depends on BR2_USE_WCHAR
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12
+	select BR2_PACKAGE_LIBMNL  

How is this related to wireguard support ?

Yes.

Quoted 15 lines

package/connman/Config.in config BR2_PACKAGE_CONNMAN_WIFI · line 57

Quoted 10 lines
package/connman/Config.in +3 -0
 	select BR2_PACKAGE_NFTABLES
 	help
 	  Use nftables as firewall.
@@ -51,6 +52,10 @@ config BR2_PACKAGE_CONNMAN_WIFI
 	  setup). ConnMan detects the start of wpa_supplicant
 	  automatically.  
 
+config BR2_PACKAGE_CONNMAN_WIREGUARD
+	bool "enable wireguard support"
+	select BR2_PACKAGE_LIBMNL  

We already had a patch from Petr at
http://patchwork.ozlabs.org/patch/1246181/ to add Wireguard support, but he was also selecting BR2_PACKAGE_WIREGUARD_TOOLS.

Quoted 1 line

Could you or Petr clarify this ?

configure.ac
found_libmnl="no"

Quoted 8 lines
if (test "${firewall_type}" = "nftables" -o \
		"${enable_wireguard}" != "no"); then
	PKG_CHECK_MODULES(LIBMNL, [libmnl >= 1.0.0], [found_libmnl="yes"],
		AC_MSG_ERROR([libmnl >= 1.0.0 not found]))
	AC_SUBST(LIBMNL_CFLAGS)
	AC_SUBST(LIBMNL_LIBS)

fi
AM_CONDITIONAL(LIBMNL, test "${found_libmnl}" != "no")

Then the "select BR2_PACKAGE_LIBMNL" added to BR2_PACKAGE_CONNMAN_NFTABLES is completely unrelated to wireguard support. connman needs libmnl if nftables is used *or* if wireguard is used.

So the missing select BR2_PACKAGE_LIBMNL in BR2_PACKAGE_CONNMAN_NFTABLES should be added as a separate patch.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#7 lore raw

PATCH 1/1 package/connman: enable wireguard

Quoted 46 lines · Thomas Petazzoni

Hello,

Quoted 31 lines · On Sun, 8 Mar 2020 18:37:18 +0100 Petr Vorel <[email protected]> wrote:
Quoted 11 lines

package/connman/Config.in config BR2_PACKAGE_CONNMAN_NFTABLES · line 36

Quoted 9 lines
package/connman/Config.in +1 -0
index ac012dda54..614b826f96 100644
@@ -33,6 +33,7 @@ config BR2_PACKAGE_CONNMAN_NFTABLES
  bool "nftables"
  depends on BR2_USE_WCHAR
  depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12
+ select BR2_PACKAGE_LIBMNL

How is this related to wireguard support ?

Yes.

Quoted 11 lines

package/connman/Config.in config BR2_PACKAGE_CONNMAN_WIFI · line 57

Quoted 10 lines
package/connman/Config.in +3 -0
  select BR2_PACKAGE_NFTABLES
  help
    Use nftables as firewall.
@@ -51,6 +52,10 @@ config BR2_PACKAGE_CONNMAN_WIFI
    setup). ConnMan detects the start of wpa_supplicant
    automatically.
 
+config BR2_PACKAGE_CONNMAN_WIREGUARD
+ bool "enable wireguard support"
+ select BR2_PACKAGE_LIBMNL
Quoted 5 lines

We already had a patch from Petr at
http://patchwork.ozlabs.org/patch/1246181/ to add Wireguard support, but he was also selecting BR2_PACKAGE_WIREGUARD_TOOLS.

Could you or Petr clarify this ?

configure.ac
found_libmnl="no"

Quoted 8 lines
if (test "${firewall_type}" = "nftables" -o \
              "${enable_wireguard}" != "no"); then
      PKG_CHECK_MODULES(LIBMNL, [libmnl >= 1.0.0], [found_libmnl="yes"],
              AC_MSG_ERROR([libmnl >= 1.0.0 not found]))
      AC_SUBST(LIBMNL_CFLAGS)
      AC_SUBST(LIBMNL_LIBS)

fi
AM_CONDITIONAL(LIBMNL, test "${found_libmnl}" != "no")

Quoted 7 lines

Then the "select BR2_PACKAGE_LIBMNL" added to BR2_PACKAGE_CONNMAN_NFTABLES is completely unrelated to wireguard support. connman needs libmnl if nftables is used *or* if wireguard is used.

So the missing select BR2_PACKAGE_LIBMNL in BR2_PACKAGE_CONNMAN_NFTABLES should be added as a separate patch.

Sent here already: https://patchwork.ozlabs.org/patch/1251106/

Quoted 8 lines

Thanks!

Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#8 lore raw

PATCH 1/1 package/connman: enable wireguard

Hi,

Quoted 8 lines
Quoted 7 lines

Then the "select BR2_PACKAGE_LIBMNL" added to BR2_PACKAGE_CONNMAN_NFTABLES is completely unrelated to wireguard support. connman needs libmnl if nftables is used *or* if wireguard is used.

So the missing select BR2_PACKAGE_LIBMNL in BR2_PACKAGE_CONNMAN_NFTABLES should be added as a separate patch.

Sent here already: https://patchwork.ozlabs.org/patch/1251106/

James, thanks for your fix!
(add my Reviewed-by: tag to it).

Sorry for wrong patch.

Kind regards,
Petr

#9 lore raw

PATCH 1/1 package/connman: enable wireguard

In reply to James Hilliard
Quoted 8 lines · On Sun, 8 Mar 2020 00:07:41 -0700 James Hilliard <[email protected]>…

We also need to select libmnl when building with wireguard support or with nftables.

---
 package/connman/Config.in  | 5 +++++
 package/connman/connman.mk | 9 ++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

I've applied to master, but only the parts related to wireguard support, as the rest was applied separately.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com