Skip to contentSkip to conversation

Enable VPN support in ConnMan

PATCH Superseded Jukka Rissanen 3 participants 11 messages May 13, 2013

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Enable VPN support in ConnMan

Hi,

v2:
- removed the DISTRO_FEATURES as suggested by Ross, now PACKAGECONFIG is used instead in connman.inc
- all generic vpn files are placed into connman-vpn package and vpn plugins rdepend on it

v1:
this patchset enables OpenVPN, vpnc, L2TP and PPTP VPN technogies in ConnMan and fixes this bug
https://bugzilla.yoctoproject.org/show_bug.cgi?id=4456

Cheers,
Jukka

Jukka Rissanen (5):
connman: Add VPN support
connman: Add OpenVPN support
connman: Add vpnc support
connman: Add L2TP support
connman: Add PPTP support

 meta/recipes-connectivity/connman/connman.inc | 88 +++++++++++++++++++++++++--
 1 file changed, 83 insertions(+), 5 deletions(-)
Signature · 1 line
1.7.11.7
#1 lore raw

PATCH v2 1/5 connman: Add VPN support

One needs to add following statement into local.conf or distro config

PACKAGECONFIG_append_pn-connman = " openvpn vpnc l2tp pptp"

in order to activate support for these VPN technogies in ConnMan.

---
 meta/recipes-connectivity/connman/connman.inc | 48 ++++++++++++++++++++++++---
 1 file changed, 43 insertions(+), 5 deletions(-)
meta/recipes-connectivity/connman/connman.inc +43 -5
index afc361c..73c7215 100644
@@ -38,6 +38,10 @@ PACKAGECONFIG ??= "\
                    ${@base_contains('DISTRO_FEATURES', '3g','3g', '', d)} \
 "
 
+# If you want ConnMan to support VPN, add following statement into
+# local.conf or distro config
+# PACKAGECONFIG_append_pn-connman = " openvpn vpnc l2tp pptp"
+
 PACKAGECONFIG[wifi] = "--enable-wifi, --disable-wifi, wpa-supplicant"
 PACKAGECONFIG[bluetooth] = "--enable-bluetooth, --disable-bluetooth, bluez4"
 PACKAGECONFIG[3g] = "--enable-ofono, --disable-ofono, ofono"
@@ -47,6 +51,7 @@ INITSCRIPT_NAME = "connman"
 INITSCRIPT_PARAMS = "start 05 5 2 3 . stop 22 0 1 6 ."
 
 SYSTEMD_SERVICE_${PN} = "connman.service"
+SYSTEMD_SERVICE_${PN}-vpn = "connman-vpn.service"
 SYSTEMD_WIRED_SETUP = "ExecStartPre=-/usr/lib/connman/wired-setup"
 
 # IMPORTANT: because xuser is shared with rootless X, please make sure the
@@ -67,6 +72,7 @@ do_configure_append () {
 # both this and the xuser patch can be dropped.
 do_compile_append() {
 	sed -i -e s:deny:allow:g src/connman-dbus.conf
+	sed -i -e s:deny:allow:g vpn/vpn-dbus.conf
 }
 
 do_install_append() {
@@ -81,13 +87,18 @@ do_install_append() {
 	install -m 0755 ${B}/client/connmanctl ${D}${bindir}
 
 	# We don't need to package an empty directory
-	rmdir ${D}${libdir}/connman/scripts
+	rmdir --ignore-fail-on-non-empty ${D}${libdir}/connman/scripts
 
 	# Automake 1.12 won't install empty directories, but we need the
 	# plugins directory to be present for ownership
 	mkdir -p ${D}${libdir}/connman/plugins
 }
 
+do_install_append_${PN}-vpn() {
+	mkdir -p ${D}${libdir}/connman/scripts
+	mkdir -p ${D}${libdir}/connman/plugins-vpn
+}
+
 # These used to be plugins, but now they are core
 RPROVIDES_${PN} = "\
 	connman-plugin-loopback \
@@ -120,6 +131,17 @@ python populate_packages_prepend() {
             rdepends = map(lambda x: multilib_prefix + x,  depmap[plugintype].split())
             bb.note( "Adding rdependency on %s to %s" % ( rdepends, package ) )
             d.setVar("RDEPENDS_%s" % package, " ".join(rdepends))
+
+    packages = []
+    plugin_dir = d.expand('${libdir}/connman/plugins-vpn/')
+    plugin_name = d.expand('${PN}-plugin-vpn-%s')
+    do_split_packages(d, plugin_dir, '^(.*).so$', plugin_name, '${PN} VPN plugin for %s', extra_depends='', hook=hook, prepend=True )
+    for (file, package) in packages:
+        plugintype = package.split( '-' )[-1]
+        if plugintype in depmap:
+            rdepends = map(lambda x: multilib_prefix + x,  depmap[plugintype].split())
+            bb.note( "Adding rdependency on %s to %s" % ( rdepends, package ) )
+            d.setVar("RDEPENDS_%s" % package, " ".join(rdepends))
 }
 
 PACKAGES =+ "${PN}-tools ${PN}-tests ${PN}-client"
@@ -131,12 +153,28 @@ RDEPENDS_${PN}-tests = "python-dbus python-pygobject python-textutils python-sub
 
 FILES_${PN}-client = "${bindir}/connmanctl"
 
-FILES_${PN} = "${bindir}/* ${sbindir}/* ${libexecdir}/* ${libdir}/lib*.so.* \
+FILES_${PN} = "${sbindir}/connmand ${libexecdir}/* ${libdir}/lib*.so.* \
             ${libdir}/connman/plugins \
-            ${sysconfdir} ${sharedstatedir} ${localstatedir} \
-            ${base_bindir}/* ${base_sbindir}/* ${base_libdir}/*.so* ${datadir}/${PN} \
-            ${datadir}/dbus-1/system-services/*"
+            ${sysconfdir}/connman ${sysconfdir}/dbus-1/system.d/connman.conf \
+            @base_contains('DISTRO_FEATURES','sysvinit','${sysconfdir}/init.d','',d)} \
+            ${sharedstatedir} ${localstatedir} \
+            ${base_bindir}/* ${base_sbindir}/* ${base_libdir}/*.so* \
+            ${datadir}/${PN}"
 
 FILES_${PN}-dbg += "${libdir}/connman/*/.debug"
 
 FILES_${PN}-dev += "${libdir}/connman/*/*.la"
+
+PACKAGES =+ "${PN}-vpn"
+
+SUMMARY_${PN}-vpn = "A daemon for managing VPN connections within embedded devices"
+DESCRIPTION_${PN}-vpn = "The ConnMan VPN provides a daemon for \
+managing VPN connections within embedded devices running the Linux \
+operating system.  The connman-vpnd handles all the VPN connections \
+and starts/stops VPN client processes when necessary. The connman-vpnd \
+provides a DBus API for managing VPN connections. All the different \
+VPN technogies are implemented using plug-ins."
+FILES_${PN}-vpn += "${sbindir}/connman-vpnd \
+                    ${sysconfdir}/dbus-1/system.d/connman-vpn-dbus.conf \
+                    ${datadir}/dbus-1/system-services/net.connman.vpn.service \
+                    ${systemd_unitdir}/system/connman-vpn.service"
Signature · 1 line
1.7.11.7
#2 lore raw

Re: [PATCH v2 1/5] connman: Add VPN support

meta/recipes-connectivity/connman/connman.inc do_install_append() { · line 101

Quoted 5 lines · Jukka Rissanen
meta/recipes-connectivity/connman/connman.inc +5 -0
+do_install_append_${PN}-vpn() {
+	mkdir -p ${D}${libdir}/connman/scripts
+	mkdir -p ${D}${libdir}/connman/plugins-vpn
+}
+

Does that actually do anything useful?

Quoted 1 line

+bb.note( "Adding rdependency on %s to %s" % ( rdepends, package ) )

I know the existing connman.inc does the same thing, but I don't think we want to proliferate this sort of debugging chit-chat in new code.

Also, the way that this code (both the existing stuff and the new block you've added) interacts with do_split_packages() is a bit hokey. You have a hook function which basically just adds an entry to a list, and then a separate loop which iterates over the resulting list and fiddles with the RDEPENDS. As far as I can tell there's no reason that the RDEPENDS tinkering couldn't be done inside the hook function itself, which would avoid having two copies of essentially the same code.

meta/recipes-connectivity/connman/connman.inc RDEPENDS_${PN}-tests = "python-dbus python-pygobject python-textutils python-sub · line 162

Quoted 11 lines
meta/recipes-connectivity/connman/connman.inc +6 -4
-FILES_${PN} = "${bindir}/* ${sbindir}/* ${libexecdir}/* ${libdir}/lib*.so.* \
+FILES_${PN} = "${sbindir}/connmand ${libexecdir}/* ${libdir}/lib*.so.* \
             ${libdir}/connman/plugins \
-            ${sysconfdir} ${sharedstatedir} ${localstatedir} \
-            ${base_bindir}/* ${base_sbindir}/* ${base_libdir}/*.so* ${datadir}/${PN} \
-            ${datadir}/dbus-1/system-services/*"
+            ${sysconfdir}/connman ${sysconfdir}/dbus-1/system.d/connman.conf \
+            @base_contains('DISTRO_FEATURES','sysvinit','${sysconfdir}/init.d','',d)} \
+            ${sharedstatedir} ${localstatedir} \
+            ${base_bindir}/* ${base_sbindir}/* ${base_libdir}/*.so* \
+            ${datadir}/${PN}"

That seems like rather a wide-ranging set of changes. You prepended ${PN}-vpn to PACKAGES which should mean that it gets first pick of the FILES. Are all those changes to FILES_${PN} actually necessary?

p.

#3 lore raw

PATCH v2 2/5 connman: Add OpenVPN support

In reply to Jukka Rissanen
---
 meta/recipes-connectivity/connman/connman.inc | 10 ++++++++++
 1 file changed, 10 insertions(+)
meta/recipes-connectivity/connman/connman.inc +10 -0
index 73c7215..6bedfa8 100644
@@ -46,6 +46,7 @@ PACKAGECONFIG[wifi] = "--enable-wifi, --disable-wifi, wpa-supplicant"
 PACKAGECONFIG[bluetooth] = "--enable-bluetooth, --disable-bluetooth, bluez4"
 PACKAGECONFIG[3g] = "--enable-ofono, --disable-ofono, ofono"
 PACKAGECONFIG[tist] = "--enable-tist,--disable-tist,"
+PACKAGECONFIG[openvpn] = "--enable-openvpn,--disable-openvpn,,openvpn"
 
 INITSCRIPT_NAME = "connman"
 INITSCRIPT_PARAMS = "start 05 5 2 3 . stop 22 0 1 6 ."
@@ -178,3 +179,12 @@ FILES_${PN}-vpn += "${sbindir}/connman-vpnd \
                     ${sysconfdir}/dbus-1/system.d/connman-vpn-dbus.conf \
                     ${datadir}/dbus-1/system-services/net.connman.vpn.service \
                     ${systemd_unitdir}/system/connman-vpn.service"
+
+SUMMARY_${PN}-plugin-vpn-openvpn = "An OpenVPN plugin for ConnMan VPN"
+DESCRIPTION_${PN}-plugin-vpn-openvpn = "The ConnMan OpenVPN plugin uses openvpn client \
+to create a VPN connection to OpenVPN server."
+FILES_${PN}-plugin-vpn-openvpn += "${libdir}/connman/scripts/openvpn-script \
+                                   ${libdir}/connman/plugins-vpn/openvpn.so"
+INSANE_SKIP_${PN}-plugin-vpn-openvpn += "dev-so"
+RDEPENDS_${PN}-plugin-vpn-openvpn += "${PN}-vpn"
+RRECOMMENDS_${PN} += "${@base_contains('PACKAGECONFIG','openvpn','${PN}-plugin-vpn-openvpn', '', d)}"
Signature · 1 line
1.7.11.7
#4 lore raw

PATCH v2 3/5 connman: Add vpnc support

In reply to Jukka Rissanen
---
 meta/recipes-connectivity/connman/connman.inc | 10 ++++++++++
 1 file changed, 10 insertions(+)
meta/recipes-connectivity/connman/connman.inc +10 -0
index 6bedfa8..25e6b22 100644
@@ -47,6 +47,7 @@ PACKAGECONFIG[bluetooth] = "--enable-bluetooth, --disable-bluetooth, bluez4"
 PACKAGECONFIG[3g] = "--enable-ofono, --disable-ofono, ofono"
 PACKAGECONFIG[tist] = "--enable-tist,--disable-tist,"
 PACKAGECONFIG[openvpn] = "--enable-openvpn,--disable-openvpn,,openvpn"
+PACKAGECONFIG[vpnc] = "--enable-vpnc,--disable-vpnc,,vpnc"
 
 INITSCRIPT_NAME = "connman"
 INITSCRIPT_PARAMS = "start 05 5 2 3 . stop 22 0 1 6 ."
@@ -188,3 +189,12 @@ FILES_${PN}-plugin-vpn-openvpn += "${libdir}/connman/scripts/openvpn-script \
 INSANE_SKIP_${PN}-plugin-vpn-openvpn += "dev-so"
 RDEPENDS_${PN}-plugin-vpn-openvpn += "${PN}-vpn"
 RRECOMMENDS_${PN} += "${@base_contains('PACKAGECONFIG','openvpn','${PN}-plugin-vpn-openvpn', '', d)}"
+
+SUMMARY_${PN}-plugin-vpn-vpnc = "A vpnc plugin for ConnMan VPN"
+DESCRIPTION_${PN}-plugin-vpn-vpnc = "The ConnMan vpnc plugin uses vpnc client \
+to create a VPN connection to Cisco3000 VPN Concentrator."
+FILES_${PN}-plugin-vpn-vpnc += "${libdir}/connman/scripts/openconnect-script \
+                                ${libdir}/connman/plugins-vpn/vpnc.so"
+INSANE_SKIP_${PN}-plugin-vpn-vpnc += "dev-so"
+RDEPENDS_${PN}-plugin-vpn-vpnc += "${PN}-vpn"
+RRECOMMENDS_${PN} += "${@base_contains('PACKAGECONFIG','vpnc','${PN}-plugin-vpn-vpnc', '', d)}"
Signature · 1 line
1.7.11.7
#5 lore raw

PATCH v2 4/5 connman: Add L2TP support

In reply to Jukka Rissanen
---
 meta/recipes-connectivity/connman/connman.inc | 10 ++++++++++
 1 file changed, 10 insertions(+)
meta/recipes-connectivity/connman/connman.inc +10 -0
index 25e6b22..e17e0e7 100644
@@ -48,6 +48,7 @@ PACKAGECONFIG[3g] = "--enable-ofono, --disable-ofono, ofono"
 PACKAGECONFIG[tist] = "--enable-tist,--disable-tist,"
 PACKAGECONFIG[openvpn] = "--enable-openvpn,--disable-openvpn,,openvpn"
 PACKAGECONFIG[vpnc] = "--enable-vpnc,--disable-vpnc,,vpnc"
+PACKAGECONFIG[l2tp] = "--enable-l2tp,--disable-l2tp,,xl2tpd"
 
 INITSCRIPT_NAME = "connman"
 INITSCRIPT_PARAMS = "start 05 5 2 3 . stop 22 0 1 6 ."
@@ -198,3 +199,12 @@ FILES_${PN}-plugin-vpn-vpnc += "${libdir}/connman/scripts/openconnect-script \
 INSANE_SKIP_${PN}-plugin-vpn-vpnc += "dev-so"
 RDEPENDS_${PN}-plugin-vpn-vpnc += "${PN}-vpn"
 RRECOMMENDS_${PN} += "${@base_contains('PACKAGECONFIG','vpnc','${PN}-plugin-vpn-vpnc', '', d)}"
+
+SUMMARY_${PN}-plugin-vpn-l2tp = "A L2TP plugin for ConnMan VPN"
+DESCRIPTION_${PN}-plugin-vpn-l2tp = "The ConnMan L2TP plugin uses xl2tpd daemon \
+to create a VPN connection to L2TP server."
+FILES_${PN}-plugin-vpn-l2tp += "${libdir}/connman/scripts/libppp-plugin.so* \
+                                ${libdir}/connman/plugins-vpn/l2tp.so"
+INSANE_SKIP_${PN}-plugin-vpn-l2tp += "dev-so"
+RDEPENDS_${PN}-plugin-vpn-l2tp += "${PN}-vpn"
+RRECOMMENDS_${PN} += "${@base_contains('PACKAGECONFIG','l2tp','${PN}-plugin-vpn-l2tp', '', d)}"
Signature · 1 line
1.7.11.7
#6 lore raw

PATCH v2 5/5 connman: Add PPTP support

In reply to Jukka Rissanen
---
 meta/recipes-connectivity/connman/connman.inc | 10 ++++++++++
 1 file changed, 10 insertions(+)
meta/recipes-connectivity/connman/connman.inc +10 -0
index e17e0e7..638e0e2 100644
@@ -49,6 +49,7 @@ PACKAGECONFIG[tist] = "--enable-tist,--disable-tist,"
 PACKAGECONFIG[openvpn] = "--enable-openvpn,--disable-openvpn,,openvpn"
 PACKAGECONFIG[vpnc] = "--enable-vpnc,--disable-vpnc,,vpnc"
 PACKAGECONFIG[l2tp] = "--enable-l2tp,--disable-l2tp,,xl2tpd"
+PACKAGECONFIG[pptp] = "--enable-pptp,--disable-pptp,,pptp-linux"
 
 INITSCRIPT_NAME = "connman"
 INITSCRIPT_PARAMS = "start 05 5 2 3 . stop 22 0 1 6 ."
@@ -208,3 +209,12 @@ FILES_${PN}-plugin-vpn-l2tp += "${libdir}/connman/scripts/libppp-plugin.so* \
 INSANE_SKIP_${PN}-plugin-vpn-l2tp += "dev-so"
 RDEPENDS_${PN}-plugin-vpn-l2tp += "${PN}-vpn"
 RRECOMMENDS_${PN} += "${@base_contains('PACKAGECONFIG','l2tp','${PN}-plugin-vpn-l2tp', '', d)}"
+
+SUMMARY_${PN}-plugin-vpn-pptp = "A PPTP plugin for ConnMan VPN"
+DESCRIPTION_${PN}-plugin-vpn-pptp = "The ConnMan PPTP plugin uses pptp-linux client \
+to create a VPN connection to PPTP server."
+FILES_${PN}-plugin-vpn-pptp += "${libdir}/connman/scripts/libppp-plugin.so* \
+                                ${libdir}/connman/plugins-vpn/pptp.so"
+INSANE_SKIP_${PN}-plugin-vpn-pptp += "dev-so"
+RDEPENDS_${PN}-plugin-vpn-pptp += "${PN}-vpn"
+RRECOMMENDS_${PN} += "${@base_contains('PACKAGECONFIG','pptp','${PN}-plugin-vpn-pptp', '', d)}"
Signature · 1 line
1.7.11.7
#7 lore raw
In reply to Jukka Rissanen
Quoted 18 lines · Jukka Rissanen

Hi,

v2:
- removed the DISTRO_FEATURES as suggested by Ross, now PACKAGECONFIG is used instead in connman.inc
- all generic vpn files are placed into connman-vpn package and vpn plugins rdepend on it

v1:
this patchset enables OpenVPN, vpnc, L2TP and PPTP VPN technogies in ConnMan and fixes this bug
https://bugzilla.yoctoproject.org/show_bug.cgi?id=4456

Cheers,
Jukka

Quoted 6 lines

Jukka Rissanen (5):
connman: Add VPN support
connman: Add OpenVPN support
connman: Add vpnc support
connman: Add L2TP support
connman: Add PPTP support

I think that 2-5 are missing

PACKAGES =+ "${PN}-vpn-foo"

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#8 lore raw

Hi Martin,

Quoted 26 lines · Martin Jansa
Quoted 18 lines · Jukka Rissanen

Hi,

v2:
- removed the DISTRO_FEATURES as suggested by Ross, now PACKAGECONFIG is used instead in connman.inc
- all generic vpn files are placed into connman-vpn package and vpn plugins rdepend on it

v1:
this patchset enables OpenVPN, vpnc, L2TP and PPTP VPN technogies in ConnMan and fixes this bug
https://bugzilla.yoctoproject.org/show_bug.cgi?id=4456

Cheers,
Jukka

Quoted 6 lines

Jukka Rissanen (5):
connman: Add VPN support
connman: Add OpenVPN support
connman: Add vpnc support
connman: Add L2TP support
connman: Add PPTP support

Quoted 4 lines

I think that 2-5 are missing

PACKAGES =+ "${PN}-vpn-foo"

The individual vpn plugin packages were created and added to distro without a problem even if they were not in PACKAGES. But I can certainly send another version that adds these.

Cheers,
Jukka

#9 lore raw
Quoted 8 lines · Jukka Rissanen
Quoted 7 lines · Martin Jansa
Quoted 6 lines

Jukka Rissanen (5):
connman: Add VPN support
connman: Add OpenVPN support
connman: Add vpnc support
connman: Add L2TP support
connman: Add PPTP support

Quoted 8 lines
Quoted 4 lines

I think that 2-5 are missing

PACKAGES =+ "${PN}-vpn-foo"

The individual vpn plugin packages were created and added to distro without a problem even if they were not in PACKAGES.
But I can certainly send another version that adds these.

If it's using do_split_packages() then you don't need to (and shouldn't) add those things to PACKAGES directly.

You might consider patching connman.inc to add the INSANE_SKIP stuff automatically since all the plugins will presumably need that treatment.

p.

#10 lore raw
Quoted 18 lines · Phil Blundell
Quoted 8 lines · Jukka Rissanen
Quoted 7 lines · Martin Jansa
Quoted 6 lines

Jukka Rissanen (5):
connman: Add VPN support
connman: Add OpenVPN support
connman: Add vpnc support
connman: Add L2TP support
connman: Add PPTP support

Quoted 8 lines
Quoted 4 lines

I think that 2-5 are missing

PACKAGES =+ "${PN}-vpn-foo"

The individual vpn plugin packages were created and added to distro without a problem even if they were not in PACKAGES.
But I can certainly send another version that adds these.

Quoted 5 lines

If it's using do_split_packages() then you don't need to (and shouldn't) add those things to PACKAGES directly.

You might consider patching connman.inc to add the INSANE_SKIP stuff automatically since all the plugins will presumably need that treatment.

Ah, I've overlooked do_split_packages in 1/5 and was surprised to see only SUMMARY/FILES additions in 2-5.

I'm sorry for noise.

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]