summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2022-01-11 23:14:39 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-01-12 07:19:35 +0000
commita8e6024a023c0f04dd5283dc772cc17fb04c8624 (patch)
treee02f0fb38af7987d54e1e8c9848d8544e1096234 /meta/recipes-connectivity
parentd907c29262d3155fe39297361b0d2eeb8d74ac18 (diff)
downloadpoky-a8e6024a023c0f04dd5283dc772cc17fb04c8624.tar.gz
connman-conf: do nothing in qemu, do not touch eth0
qemu kernel itself is nowdays perfectly capable of setting up what was passed in via ip=: [ 1.676847] IP-Config: Complete: [ 1.677768] device=eth0, hwaddr=52:54:00:12:34:02, ipaddr=192.168.7.2, mask=255.255.255.0, gw=192.168.7.1 [ 1.679933] host=192.168.7.2, domain=, nis-domain=(none) [ 1.681201] bootserver=255.255.255.255, rootserver=255.255.255.255, rootpath= [ 1.681203] nameserver0=8.8.8.8 connman-conf only does the same thing again by (badly and incompletely) parsing those parameters with sed. (From OE-Core rev: 3c25b89720417a7b1963f0a32c870208a5803950) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity')
-rw-r--r--meta/recipes-connectivity/connman/connman-conf.bb33
-rw-r--r--meta/recipes-connectivity/connman/connman-conf/qemuall/wired-connection.service10
-rw-r--r--meta/recipes-connectivity/connman/connman-conf/qemuall/wired-setup16
-rw-r--r--meta/recipes-connectivity/connman/connman-conf/qemuall/wired.config9
-rw-r--r--meta/recipes-connectivity/connman/connman/connman5
5 files changed, 10 insertions, 63 deletions
diff --git a/meta/recipes-connectivity/connman/connman-conf.bb b/meta/recipes-connectivity/connman/connman-conf.bb
index 006f976997..97ac49818c 100644
--- a/meta/recipes-connectivity/connman/connman-conf.bb
+++ b/meta/recipes-connectivity/connman/connman-conf.bb
@@ -1,36 +1,19 @@
1SUMMARY = "Connman config to setup wired interface on qemu machines" 1SUMMARY = "Connman config to ignore wired interface on qemu machines"
2DESCRIPTION = "This is the ConnMan configuration to set up a Wired \ 2DESCRIPTION = "This is the ConnMan configuration to avoid touching wired \
3network interface for a qemu machine." 3network interface inside qemu machines."
4LICENSE = "GPLv2" 4LICENSE = "GPLv2"
5LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" 5LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
6 6
7inherit systemd
8
9SRC_URI:append:qemuall = " file://wired.config \
10 file://wired-setup \
11 file://wired-connection.service \
12"
13PR = "r2" 7PR = "r2"
14 8
15S = "${WORKDIR}" 9S = "${WORKDIR}"
16 10
17PACKAGE_ARCH = "${MACHINE_ARCH}" 11PACKAGE_ARCH = "${MACHINE_ARCH}"
18 12
19FILES:${PN} = "${localstatedir}/* ${datadir}/*" 13FILES:${PN} = "${sysconfdir}/*"
20 14
21do_install() { 15# Kernel IP-Config is perfectly capable of setting up networking passed in via ip=
22 #Configure Wired network interface in case of qemu* machines 16do_install:append:qemuall() {
23 if test -e ${WORKDIR}/wired.config && 17 mkdir -p ${D}${sysconfdir}/default
24 test -e ${WORKDIR}/wired-setup && 18 echo "export EXTRA_PARAM=\"-I eth0\"" > ${D}${sysconfdir}/default/connman
25 test -e ${WORKDIR}/wired-connection.service; then
26 install -d ${D}${localstatedir}/lib/connman
27 install -m 0644 ${WORKDIR}/wired.config ${D}${localstatedir}/lib/connman
28 install -d ${D}${datadir}/connman
29 install -m 0755 ${WORKDIR}/wired-setup ${D}${datadir}/connman
30 install -d ${D}${systemd_system_unitdir}
31 install -m 0644 ${WORKDIR}/wired-connection.service ${D}${systemd_system_unitdir}
32 sed -i -e 's|@SCRIPTDIR@|${datadir}/connman|g' ${D}${systemd_system_unitdir}/wired-connection.service
33 fi
34} 19}
35
36SYSTEMD_SERVICE:${PN}:qemuall = "wired-connection.service"
diff --git a/meta/recipes-connectivity/connman/connman-conf/qemuall/wired-connection.service b/meta/recipes-connectivity/connman/connman-conf/qemuall/wired-connection.service
deleted file mode 100644
index 48adfc08ac..0000000000
--- a/meta/recipes-connectivity/connman/connman-conf/qemuall/wired-connection.service
+++ /dev/null
@@ -1,10 +0,0 @@
1[Unit]
2Description=Setup a wired interface
3Before=connman.service
4
5[Service]
6Type=oneshot
7ExecStart=@SCRIPTDIR@/wired-setup
8
9[Install]
10WantedBy=network.target
diff --git a/meta/recipes-connectivity/connman/connman-conf/qemuall/wired-setup b/meta/recipes-connectivity/connman/connman-conf/qemuall/wired-setup
deleted file mode 100644
index c46899ef32..0000000000
--- a/meta/recipes-connectivity/connman/connman-conf/qemuall/wired-setup
+++ /dev/null
@@ -1,16 +0,0 @@
1#!/bin/sh
2
3CONFIGF=/var/lib/connman/wired.config
4
5# Extract wired network config from /proc/cmdline
6NET_CONF=`cat /proc/cmdline |sed -ne 's/^.*ip=\([^ ]*\):\([^ ]*\):\([^ ]*\):\([^ ]*\).*$/\1\/\4\/\3/p'`
7
8# Check if eth0 is already set via kernel cmdline
9if [ "x$NET_CONF" = "x" ]; then
10 # Wired interface is not configured via kernel cmdline
11 # Remove connman config file template
12 rm -f ${CONFIGF}
13else
14 # Setup a connman config accordingly
15 sed -i -e "s|^IPv4 =.*|IPv4 = ${NET_CONF}|" ${CONFIGF}
16fi
diff --git a/meta/recipes-connectivity/connman/connman-conf/qemuall/wired.config b/meta/recipes-connectivity/connman/connman-conf/qemuall/wired.config
deleted file mode 100644
index 42998ce897..0000000000
--- a/meta/recipes-connectivity/connman/connman-conf/qemuall/wired.config
+++ /dev/null
@@ -1,9 +0,0 @@
1[global]
2Name = Wired
3Description = Wired network configuration
4
5[service_ethernet]
6Type = ethernet
7IPv4 =
8MAC = 52:54:00:12:34:56
9Nameservers = 8.8.8.8
diff --git a/meta/recipes-connectivity/connman/connman/connman b/meta/recipes-connectivity/connman/connman/connman
index c64fa0d715..310a696863 100644
--- a/meta/recipes-connectivity/connman/connman/connman
+++ b/meta/recipes-connectivity/connman/connman/connman
@@ -27,7 +27,6 @@ while read dev mtpt fstype rest; do
27done 27done
28 28
29do_start() { 29do_start() {
30 EXTRA_PARAM=""
31 if test $nfsroot -eq 1 ; then 30 if test $nfsroot -eq 1 ; then
32 NET_DEVS=`cat /proc/net/dev | sed -ne 's/^\([a-zA-Z0-9 ]*\):.*$/\1/p'` 31 NET_DEVS=`cat /proc/net/dev | sed -ne 's/^\([a-zA-Z0-9 ]*\):.*$/\1/p'`
33 NET_ADDR=`cat /proc/cmdline | sed -ne 's/^.*ip=\([^ :]*\).*$/\1/p'` 32 NET_ADDR=`cat /proc/cmdline | sed -ne 's/^.*ip=\([^ :]*\).*$/\1/p'`
@@ -36,13 +35,13 @@ do_start() {
36 if [ "$NET_ADDR" = dhcp ]; then 35 if [ "$NET_ADDR" = dhcp ]; then
37 ethn=`ifconfig | grep "^eth" | sed -e "s/\(eth[0-9]\)\(.*\)/\1/"` 36 ethn=`ifconfig | grep "^eth" | sed -e "s/\(eth[0-9]\)\(.*\)/\1/"`
38 if [ ! -z "$ethn" ]; then 37 if [ ! -z "$ethn" ]; then
39 EXTRA_PARAM="-I $ethn" 38 EXTRA_PARAM="$EXTRA_PARAM -I $ethn"
40 fi 39 fi
41 else 40 else
42 for i in $NET_DEVS; do 41 for i in $NET_DEVS; do
43 ADDR=`ifconfig $i | sed 's/addr://g' | sed -ne 's/^.*inet \([0-9.]*\) .*$/\1/p'` 42 ADDR=`ifconfig $i | sed 's/addr://g' | sed -ne 's/^.*inet \([0-9.]*\) .*$/\1/p'`
44 if [ "$NET_ADDR" = "$ADDR" ]; then 43 if [ "$NET_ADDR" = "$ADDR" ]; then
45 EXTRA_PARAM="-I $i" 44 EXTRA_PARAM="$EXTRA_PARAM -I $i"
46 break 45 break
47 fi 46 fi
48 done 47 done