* [PATCH v4] connman: ignore the networking device which nfs for rootfs is working on
@ 2013-10-18 8:12 rongqing.li
2013-10-18 8:57 ` Koen Kooi
2013-10-18 11:17 ` Burton, Ross
0 siblings, 2 replies; 9+ messages in thread
From: rongqing.li @ 2013-10-18 8:12 UTC (permalink / raw)
To: openembedded-core
From: Roy Li <rongqing.li@windriver.com>
Create connman-evn.service, which will run a script to compute the networking
device when nfs root is on, and pass the result to connman.service
Copy Connmand.service from source code, add ExecStartPre into it to release
do_configure_append work, use the options which is passed by connman-evn.service
Signed-off-by: Roy Li <rongqing.li@windriver.com>
---
meta/recipes-connectivity/connman/connman.inc | 18 +++++----
.../connman/connman/connman-env.service | 13 ++++++
.../connman/connman/connman.service | 14 +++++++
.../connman/connman/connmand-env | 42 ++++++++++++++++++++
meta/recipes-connectivity/connman/connman_1.18.bb | 3 ++
5 files changed, 83 insertions(+), 7 deletions(-)
create mode 100644 meta/recipes-connectivity/connman/connman/connman-env.service
create mode 100644 meta/recipes-connectivity/connman/connman/connman.service
create mode 100644 meta/recipes-connectivity/connman/connman/connmand-env
diff --git a/meta/recipes-connectivity/connman/connman.inc b/meta/recipes-connectivity/connman/connman.inc
index 12f3edd..c2d71e0 100644
--- a/meta/recipes-connectivity/connman/connman.inc
+++ b/meta/recipes-connectivity/connman/connman.inc
@@ -64,15 +64,9 @@ python __anonymous () {
SYSTEMD_SERVICE_${PN} = "connman.service"
SYSTEMD_SERVICE_${PN}-vpn = "connman-vpn.service"
-SYSTEMD_WIRED_SETUP = "ExecStartPre=-${libdir}/connman/wired-setup"
inherit autotools gtk-doc pkgconfig systemd update-rc.d
-do_configure_append () {
- sed -i "s#ExecStart=#${SYSTEMD_WIRED_SETUP}\nExecStart=#" ${S}/src/connman.service
-
-}
-
# This allows *everyone* to access ConnMan over DBus, without any access
# control. Really the at_console flag should work, which would mean that
# both this and the xuser patch can be dropped.
@@ -88,6 +82,16 @@ do_install_append() {
sed -i s%@LIBDIR@%${libdir}% ${D}${sysconfdir}/init.d/connman
fi
+ if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+ install -m 0755 ${WORKDIR}/connmand-env ${D}${sbindir}/
+ install -m 0644 ${WORKDIR}/connman-env.service ${D}/${systemd_unitdir}/system/
+ install -m 0644 ${WORKDIR}/connman.service ${D}/${systemd_unitdir}/system/
+ sed -i -e 's,@SBINDIR@,${sbindir},g' \
+ -e 's,@LIBDIR@,${libdir},g' \
+ -e 's,@LOCALSTATEDIR@,${localstatedir},g' \
+ ${D}${systemd_unitdir}/system/*.service
+ fi
+
install -d ${D}${bindir}
install -m 0755 ${S}/tools/*-test ${D}${bindir}
if [ -e ${S}/tools/wispr ]; then
@@ -163,7 +167,7 @@ FILES_${PN} = "${bindir}/* ${sbindir}/* ${libexecdir}/* ${libdir}/lib*.so.* \
${libdir}/connman/plugins \
${sysconfdir} ${sharedstatedir} ${localstatedir} \
${base_bindir}/* ${base_sbindir}/* ${base_libdir}/*.so* ${datadir}/${PN} \
- ${datadir}/dbus-1/system-services/*"
+ ${datadir}/dbus-1/system-services/* ${systemd_unitdir}/system/connman-env.service"
FILES_${PN}-dbg += "${libdir}/connman/*/.debug"
diff --git a/meta/recipes-connectivity/connman/connman/connman-env.service b/meta/recipes-connectivity/connman/connman/connman-env.service
new file mode 100644
index 0000000..c4dc278
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/connman-env.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Generate options for connection service
+Before=connman.service
+ConditionKernelCommandLine=root=/dev/nfs
+After=syslog.target
+
+[Service]
+Type=oneshot
+ExecStart=@SBINDIR@/connmand-env
+StandardOutput=null
+
+[Install]
+WantedBy=connman.service
diff --git a/meta/recipes-connectivity/connman/connman/connman.service b/meta/recipes-connectivity/connman/connman/connman.service
new file mode 100644
index 0000000..aa0e49a
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/connman.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Connection service
+After=syslog.target
+Wants=connman-env.service
+
+[Service]
+Type=dbus
+BusName=net.connman
+EnvironmentFile=-@LOCALSTATEDIR@/run/connmand.env
+ExecStartPre=-@LIBDIR@/connman/wired-setup
+ExecStart=@SBINDIR@/connmand -n $CONNMAND_OPTS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta/recipes-connectivity/connman/connman/connmand-env b/meta/recipes-connectivity/connman/connman/connmand-env
new file mode 100644
index 0000000..ffdf70a
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/connmand-env
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+nfsroot=0
+
+exec 9<&0 < /proc/mounts
+while read dev mtpt fstype rest; do
+ if test $mtpt = "/" ; then
+ case $fstype in
+ nfs | nfs4)
+ nfsroot=1
+ break
+ ;;
+ *)
+ ;;
+ esac
+ fi
+done
+
+EXTRA_PARAM=""
+if test $nfsroot -eq 1 ; then
+ NET_DEVS=`cat /proc/net/dev | sed -ne 's/^\([a-zA-Z0-9 ]*\):.*$/\1/p'`
+ NET_ADDR=`cat /proc/cmdline | sed -ne 's/^.*ip=\([^ :]*\).*$/\1/p'`
+
+ if [ ! -z "$NET_ADDR" ]; then
+ if [ "$NET_ADDR" = dhcp ]; then
+ ethn=`ifconfig | grep "^eth" | sed -e "s/\(eth[0-9]\)\(.*\)/\1/"`
+ if [ ! -z "$ethn" ]; then
+ EXTRA_PARAM="-I $ethn"
+ fi
+ else
+ for i in $NET_DEVS; do
+ ADDR=`ifconfig $i | sed 's/addr://g' | sed -ne 's/^.*inet \([0-9.]*\) .*$/\1/p'`
+ if [ "$NET_ADDR" = "$ADDR" ]; then
+ EXTRA_PARAM="-I $i"
+ break
+ fi
+ done
+ fi
+ fi
+fi
+
+echo "CONNMAND_OPTS=$EXTRA_PARAM">/run/connmand.env
diff --git a/meta/recipes-connectivity/connman/connman_1.18.bb b/meta/recipes-connectivity/connman/connman_1.18.bb
index 44a4a07..eee8116 100644
--- a/meta/recipes-connectivity/connman/connman_1.18.bb
+++ b/meta/recipes-connectivity/connman/connman_1.18.bb
@@ -4,6 +4,9 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \
file://0001-plugin.h-Change-visibility-to-default-for-debug-symb.patch \
file://add_xuser_dbus_permission.patch \
file://connman \
+ file://connmand-env \
+ file://connman.service \
+ file://connman-env.service \
"
SRC_URI[md5sum] = "7578ec8f0422d34f5a4ba51b605fe576"
--
1.7.10.4
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v4] connman: ignore the networking device which nfs for rootfs is working on
2013-10-18 8:12 [PATCH v4] connman: ignore the networking device which nfs for rootfs is working on rongqing.li
@ 2013-10-18 8:57 ` Koen Kooi
2013-10-18 9:03 ` Rongqing Li
2013-10-18 11:17 ` Burton, Ross
1 sibling, 1 reply; 9+ messages in thread
From: Koen Kooi @ 2013-10-18 8:57 UTC (permalink / raw)
To: rongqing.li; +Cc: openembedded-core
Op 18 okt. 2013, om 10:12 heeft rongqing.li@windriver.com het volgende geschreven:
> From: Roy Li <rongqing.li@windriver.com>
>
> Create connman-evn.service, which will run a script to compute the networking
> device when nfs root is on, and pass the result to connman.service
>
> Copy Connmand.service from source code, add ExecStartPre into it to release
> do_configure_append work, use the options which is passed by connman-evn.service
>
> Signed-off-by: Roy Li <rongqing.li@windriver.com>
> ---
>
> +++ b/meta/recipes-connectivity/connman/connman/connman-env.service
> @@ -0,0 +1,13 @@
> +[Unit]
> +Description=Generate options for connection service
> +Before=connman.service
> +ConditionKernelCommandLine=root=/dev/nfs
So this only runs when using NFS root and calls...
> +After=syslog.target
> +
> +[Service]
> +Type=oneshot
> +ExecStart=@SBINDIR@/connmand-env
... the above script. Let's see what the script does below ...
> +++ b/meta/recipes-connectivity/connman/connman/connmand-env
> @@ -0,0 +1,42 @@
> +#!/bin/sh
> +
> +nfsroot=0
> +
> +exec 9<&0 < /proc/mounts
> +while read dev mtpt fstype rest; do
> + if test $mtpt = "/" ; then
> + case $fstype in
> + nfs | nfs4)
> + nfsroot=1
> + break
> + ;;
> + *)
> + ;;
> + esac
> + fi
> +done
> +
> +EXTRA_PARAM=""
> +if test $nfsroot -eq 1 ; then
Ah. A whole lot of tests for a script that only runs *after* NFS root has been detected already. Looks like you can kill that part of the script.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4] connman: ignore the networking device which nfs for rootfs is working on
2013-10-18 8:12 [PATCH v4] connman: ignore the networking device which nfs for rootfs is working on rongqing.li
2013-10-18 8:57 ` Koen Kooi
@ 2013-10-18 11:17 ` Burton, Ross
2013-10-18 12:47 ` Enrico Scholz
1 sibling, 1 reply; 9+ messages in thread
From: Burton, Ross @ 2013-10-18 11:17 UTC (permalink / raw)
To: rongqing.li@windriver.com; +Cc: OE-core
Hi,
Can you explain why connman needs to ignore the device that NFS is
reading the rootfs from? I ask because the very latest connman
release shouldn't be dropping and re-configuring interfaces if there's
a provisioned configuration for them (see connman-conf, which does
this for all qemu machines) and that configuration matches the current
configuration. Would this be sufficient for the rootfs-on-NFS
situation?
Ross
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4] connman: ignore the networking device which nfs for rootfs is working on
2013-10-18 11:17 ` Burton, Ross
@ 2013-10-18 12:47 ` Enrico Scholz
2013-10-22 14:37 ` Iorga, Cristian
0 siblings, 1 reply; 9+ messages in thread
From: Enrico Scholz @ 2013-10-18 12:47 UTC (permalink / raw)
To: openembedded-core
"Burton, Ross" <ross.burton-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
writes:
> Can you explain why connman needs to ignore the device that NFS is
> reading the rootfs from? I ask because the very latest connman
> release shouldn't be dropping and re-configuring interfaces if there's
> a provisioned configuration for them (see connman-conf, which does
> this for all qemu machines) and that configuration matches the current
> configuration. Would this be sufficient for the rootfs-on-NFS
> situation?
not really... the provisioning stuff does not seem to work for the
'ip=dhcp' case.
I know that this case is not handled well with this patch either (it
misses renewal of dhcp leases, setup of dns + ntp). But it is still
better than actual behavior.
On first glance, the do-not-cleanup patch in connman seems to cover
system startup only. I might miss something, but afais, interface will
be still shut down in the middle of reboot which is bad because '/' is
needed nearly to the end of shutdown.
Enrico
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4] connman: ignore the networking device which nfs for rootfs is working on
2013-10-18 12:47 ` Enrico Scholz
@ 2013-10-22 14:37 ` Iorga, Cristian
2013-10-22 14:54 ` Enrico Scholz
0 siblings, 1 reply; 9+ messages in thread
From: Iorga, Cristian @ 2013-10-22 14:37 UTC (permalink / raw)
To: Enrico Scholz, openembedded-core@lists.openembedded.org
Sorry to ask, what is this case: 'ip=dhcp'?
Care to clarify?
-----Original Message-----
From: openembedded-core-bounces@lists.openembedded.org [mailto:openembedded-core-bounces@lists.openembedded.org] On Behalf Of Enrico Scholz
Sent: Friday, October 18, 2013 3:48 PM
To: openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH v4] connman: ignore the networking device which nfs for rootfs is working on
"Burton, Ross" <ross.burton-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
writes:
> Can you explain why connman needs to ignore the device that NFS is
> reading the rootfs from? I ask because the very latest connman
> release shouldn't be dropping and re-configuring interfaces if there's
> a provisioned configuration for them (see connman-conf, which does
> this for all qemu machines) and that configuration matches the current
> configuration. Would this be sufficient for the rootfs-on-NFS
> situation?
not really... the provisioning stuff does not seem to work for the 'ip=dhcp' case.
I know that this case is not handled well with this patch either (it misses renewal of dhcp leases, setup of dns + ntp). But it is still better than actual behavior.
On first glance, the do-not-cleanup patch in connman seems to cover system startup only. I might miss something, but afais, interface will be still shut down in the middle of reboot which is bad because '/' is needed nearly to the end of shutdown.
Enrico
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4] connman: ignore the networking device which nfs for rootfs is working on
2013-10-22 14:37 ` Iorga, Cristian
@ 2013-10-22 14:54 ` Enrico Scholz
2013-10-22 15:00 ` Iorga, Cristian
0 siblings, 1 reply; 9+ messages in thread
From: Enrico Scholz @ 2013-10-22 14:54 UTC (permalink / raw)
To: Iorga, Cristian; +Cc: openembedded-core@lists.openembedded.org
"Iorga, Cristian" <cristian.iorga@intel.com> writes:
> Sorry to ask, what is this case: 'ip=dhcp'?
That's the case when kernel gets the ip by dhcp (--> CONFIG_IP_PNP); it
is configured by a 'ip=dhcp' kernel cmdline option.
Enrico
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4] connman: ignore the networking device which nfs for rootfs is working on
2013-10-22 14:54 ` Enrico Scholz
@ 2013-10-22 15:00 ` Iorga, Cristian
2013-10-22 15:13 ` Enrico Scholz
0 siblings, 1 reply; 9+ messages in thread
From: Iorga, Cristian @ 2013-10-22 15:00 UTC (permalink / raw)
To: Enrico Scholz; +Cc: openembedded-core@lists.openembedded.org
I might be wrong, but I fail to see how this relates to our situation.
Care to elaborate?
Thanks,
Cristian
-----Original Message-----
From: Enrico Scholz [mailto:enrico.scholz@sigma-chemnitz.de]
Sent: Tuesday, October 22, 2013 5:54 PM
To: Iorga, Cristian
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH v4] connman: ignore the networking device which nfs for rootfs is working on
"Iorga, Cristian" <cristian.iorga@intel.com> writes:
> Sorry to ask, what is this case: 'ip=dhcp'?
That's the case when kernel gets the ip by dhcp (--> CONFIG_IP_PNP); it is configured by a 'ip=dhcp' kernel cmdline option.
Enrico
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4] connman: ignore the networking device which nfs for rootfs is working on
2013-10-22 15:00 ` Iorga, Cristian
@ 2013-10-22 15:13 ` Enrico Scholz
0 siblings, 0 replies; 9+ messages in thread
From: Enrico Scholz @ 2013-10-22 15:13 UTC (permalink / raw)
To: Iorga, Cristian; +Cc: openembedded-core@lists.openembedded.org
"Iorga, Cristian" <cristian.iorga@intel.com> writes:
> I might be wrong, but I fail to see how this relates to our situation.
> Care to elaborate?
The provisining works only when static ips are configured. Using connman
in dhcp setup will do all the bad things which were tried to be fixed by
the provisioning (bringing down interface, clearing default route).
Ideally, provisioning mechanism would be extended so that connman uses
dhcp by requesting current ip and without reconfiguring the interface
(neither on startup, nor on shutdown).
But for now, only solution seems to ignore the netwrok interface which
is done by the patch.
Enrico
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-10-22 15:13 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-18 8:12 [PATCH v4] connman: ignore the networking device which nfs for rootfs is working on rongqing.li
2013-10-18 8:57 ` Koen Kooi
2013-10-18 9:03 ` Rongqing Li
2013-10-18 11:17 ` Burton, Ross
2013-10-18 12:47 ` Enrico Scholz
2013-10-22 14:37 ` Iorga, Cristian
2013-10-22 14:54 ` Enrico Scholz
2013-10-22 15:00 ` Iorga, Cristian
2013-10-22 15:13 ` Enrico Scholz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox