Patchwork [2/2] connman: Wired inteface provisioned via qemu

login
register
mail settings
Submitter Cristian Iorga
Date March 1, 2013, 4:48 p.m.
Message ID <1362156507-10571-3-git-send-email-cristian.iorga@intel.com>
Download mbox | patch
Permalink /patch/45369/
State Accepted
Commit 5711e0cf88fac0de8a5317b16a287b335c827c8f
Headers show

Comments

Cristian Iorga - March 1, 2013, 4:48 p.m.
- connman-conf package re-implemented
- connman 1.12 introduces provisioning for
wired interfaces also;
- wired interface settings are read from
kernel cmdline if present;
- after that are passed to connman as a
config file
- for BA, this is not needed, as BA will
have a network infrastructure to work with.

Fixes [YOCTO #3227];
Fixes [YOCTO #3804];
Fixes [YOCTO #3843].

Signed-off-by: Cristian Iorga <cristian.iorga@intel.com>
---
 meta/recipes-connectivity/connman/connman-conf.bb     |   17 ++++++++++-------
 .../connman/connman-conf/qemuall/main.conf            |    3 ---
 .../connman/connman-conf/qemuall/wired-setup          |   16 ++++++++++++++++
 .../connman/connman-conf/qemuall/wired.config         |    8 ++++++++
 meta/recipes-connectivity/connman/connman/connman     |    3 +++
 5 files changed, 37 insertions(+), 10 deletions(-)
 delete mode 100644 meta/recipes-connectivity/connman/connman-conf/qemuall/main.conf
 create mode 100644 meta/recipes-connectivity/connman/connman-conf/qemuall/wired-setup
 create mode 100644 meta/recipes-connectivity/connman/connman-conf/qemuall/wired.config

Patch

diff --git a/meta/recipes-connectivity/connman/connman-conf.bb b/meta/recipes-connectivity/connman/connman-conf.bb
index 7c7ef26..7b99953 100644
--- a/meta/recipes-connectivity/connman/connman-conf.bb
+++ b/meta/recipes-connectivity/connman/connman-conf.bb
@@ -1,18 +1,21 @@ 
-#connman config to ignore wired interfaces on qemu machines
+#connman config to setup wired interface on qemu machines
 
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
 
-SRC_URI_append_qemuall = " file://main.conf"
-
-PR = "r0"
+SRC_URI_append_qemuall = "file://wired.config \
+                          file://wired-setup \
+                         "
+PR = "r1"
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 do_install() {
-    #Blacklist ethn network interface in case of qemu* machines
-    if test -e ${WORKDIR}/main.conf; then
+    #Configure Wired network interface in case of qemu* machines
+    if test -e ${WORKDIR}/wired.config && test -e ${WORKDIR}/wired-setup; then
+        install -d ${D}${localstatedir}/lib/connman
+        install -m 0644 ${WORKDIR}/wired.config ${D}${localstatedir}/lib/connman
         install -d ${D}${sysconfdir}/connman
-        install -m 0644 ${WORKDIR}/main.conf ${D}${sysconfdir}/connman
+        install -m 0755 ${WORKDIR}/wired-setup ${D}${sysconfdir}/connman
     fi
 }
diff --git a/meta/recipes-connectivity/connman/connman-conf/qemuall/main.conf b/meta/recipes-connectivity/connman/connman-conf/qemuall/main.conf
deleted file mode 100644
index 01973e7..0000000
--- a/meta/recipes-connectivity/connman/connman-conf/qemuall/main.conf
+++ /dev/null
@@ -1,3 +0,0 @@ 
-[General]
-
-NetworkInterfaceBlacklist = eth
diff --git a/meta/recipes-connectivity/connman/connman-conf/qemuall/wired-setup b/meta/recipes-connectivity/connman/connman-conf/qemuall/wired-setup
new file mode 100644
index 0000000..135a6c1
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman-conf/qemuall/wired-setup
@@ -0,0 +1,16 @@ 
+#!/bin/sh
+
+CONFIGF=/var/lib/connman/wired.config
+
+# Extract wired network config from /proc/cmdline
+NET_CONF=`cat /proc/cmdline |sed -ne 's/^.*ip=\([^ ]*\):\([^ ]*\):\([^ ]*\):\([^ ]*\).*$/\1\/\4\/\3/p'`
+
+# Check if eth0 is already set via kernel cmdline
+if [ "x$NET_CONF" = "x" ]; then
+	# Wired interface is not configured via kernel cmdline
+	# Remove connman config file template
+	rm ${CONFIGF}
+else
+	# Setup a connman config accordingly
+	sed -i -e "s|^\(IPv4 =\)|\1 ${NET_CONF}|" ${CONFIGF}
+fi
diff --git a/meta/recipes-connectivity/connman/connman-conf/qemuall/wired.config b/meta/recipes-connectivity/connman/connman-conf/qemuall/wired.config
new file mode 100644
index 0000000..996e429
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman-conf/qemuall/wired.config
@@ -0,0 +1,8 @@ 
+[global]
+Name = Wired
+Description = Wired network configuration
+
+[service_ethernet]
+Type = ethernet
+IPv4 =
+MAC = 52:54:00:12:34:56
diff --git a/meta/recipes-connectivity/connman/connman/connman b/meta/recipes-connectivity/connman/connman/connman
index aed4a79..ffd7fac 100644
--- a/meta/recipes-connectivity/connman/connman/connman
+++ b/meta/recipes-connectivity/connman/connman/connman
@@ -32,6 +32,9 @@  do_start() {
 		ethn=`ifconfig | grep eth | sed -e "s/\(eth[0-9]\)\(.*\)/\1/"`
 		EXTRA_PARAM="-I $ethn"
 	fi
+	if [ -f /etc/connman/wired-setup ] ; then
+		. /etc/connman/wired-setup
+	fi
 	$DAEMON $EXTRA_PARAM
 }