Patchwork connman: Try to figure out NFS root interface if using DHCP

login
register
mail settings
Submitter Jukka Rissanen
Date Sept. 17, 2013, 7:48 a.m.
Message ID <1379404080-28423-1-git-send-email-jukka.rissanen@linux.intel.com>
Download mbox | patch
Permalink /patch/58229/
State Accepted
Commit 42ef04b3648f4e29ed130ff8e37800f5aac44b15
Headers show

Comments

Jukka Rissanen - Sept. 17, 2013, 7:48 a.m.
The commit c73487302270a7c2d3bbbb191ce1dd63ee2016dc missed the case
where the NFS is using DHCP.

[YOCTO #5176]

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
---
 meta/recipes-connectivity/connman/connman/connman | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

Patch

diff --git a/meta/recipes-connectivity/connman/connman/connman b/meta/recipes-connectivity/connman/connman/connman
index 2625ade..bf7a94a 100644
--- a/meta/recipes-connectivity/connman/connman/connman
+++ b/meta/recipes-connectivity/connman/connman/connman
@@ -30,16 +30,23 @@  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'`
+	    NET_ADDR=`cat /proc/cmdline | sed -ne 's/^.*ip=\([^ :]*\).*$/\1/p'`
 
-	    if [ x$NET_ADDR != x ]; then
-		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
 	if [ -f @LIBDIR@/connman/wired-setup ] ; then