All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] connman: get the correct network interface name from dmesg during NFS booting
@ 2016-10-10 17:35 Jagadeesh Krishnanjanappa
  2016-10-11  7:41 ` Andreas Oberritter
  0 siblings, 1 reply; 12+ messages in thread
From: Jagadeesh Krishnanjanappa @ 2016-10-10 17:35 UTC (permalink / raw)
  To: openembedded-core

Following are the drawbacks with the current logic:
1. If ip=dhcp in the boot command line, then the
current code makes connman to ignore "eth0" network interface
from managing internet connections. This can cause NFS boot
failure, if the network interface used for NFS booting 
is other than "eth0".

2. If ip=bootp in the boot command line, then none of the
network interfaces are ignored. This makes connman to manage
internet connections on every active network interfaces
(including the network interface used for NFS booting), resulting
hang during NFS boot.

This patch finds the network interface used for NFS booting via dmesg.
It searches for "device=" string from dmesg output and finds
name of network interface used for NFS. The "device=" string
is printed from dmesg, if IPCONFIG_SILENT macro is disabled
in the kernel, and this macro is disabled by default.

If "device=" string is not found, then falls back to earlier logic.
The earlier logic of detecting NFS network interface is retained, as
we cannot determine the exact network interface name used during
NFS bootup.

Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa@mvista.com>
---
 meta/recipes-connectivity/connman/connman/connman | 35 +++++++++++++----------
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/meta/recipes-connectivity/connman/connman/connman b/meta/recipes-connectivity/connman/connman/connman
index c64fa0d..aae2ca6 100644
--- a/meta/recipes-connectivity/connman/connman/connman
+++ b/meta/recipes-connectivity/connman/connman/connman
@@ -29,23 +29,28 @@ done
 do_start() {
 	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'`
+	    ethn_from_dmesg=`dmesg | grep "device="| sed "s|\(.*\)device=\(.*\), hwaddr=\(.*\)|\2|g"`
+	    if [ ! -z "$ethn_from_dmesg" ]; then
+		EXTRA_PARAM="-I $ethn_from_dmesg"
+	    else
+		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
+		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
-		    done
+		    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
 	fi
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-10-19 18:52 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-10 17:35 [PATCH] connman: get the correct network interface name from dmesg during NFS booting Jagadeesh Krishnanjanappa
2016-10-11  7:41 ` Andreas Oberritter
2016-10-11 12:11   ` Jagadeesh Krishnanjanappa
2016-10-11 15:36     ` Christopher Larson
2016-10-11 19:03       ` Jagadeesh Krishnanjanappa
2016-10-11 19:34         ` Christopher Larson
2016-10-12  7:30           ` Andreas Oberritter
2016-10-12 17:49             ` Christopher Larson
2016-10-12 19:08               ` Andreas Oberritter
2016-10-12  7:00     ` Andreas Oberritter
2016-10-13  2:01       ` Jagadeesh Krishnanjanappa
2016-10-19 18:52         ` Jagadeesh Krishnanjanappa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.