Date: Wed, 19 Mar 2008 11:10:02 GMT From: Robert Schulze <rs@bytecamp.net> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/121566: [nfs] [request] ethernet iface should be brought up when booting from a mfs_root over nfs Message-ID: <200803191110.m2JBA2Jt091527@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/121566; it has been noted by GNATS. From: Robert Schulze <rs@bytecamp.net> To: bug-followup@FreeBSD.org, rs@bytecamp.net Cc: Subject: Re: kern/121566: [nfs] [request] ethernet iface should be brought up when booting from a mfs_root over nfs Date: Wed, 19 Mar 2008 11:30:39 +0100 This is a multi-part message in MIME format. --------------080908080007060209020005 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Hi, I found a workaround to simulate the behaviour of /sys/nfsclient/nfs_vfsops.c in rc.initdiskless. The patch in "diff -Naur" format is attached. with kind regards, Robert Schulze --------------080908080007060209020005 Content-Type: text/x-patch; name="rc.initdiskless.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="rc.initdiskless.patch" --- rc.initdiskless.dflt Thu Mar 13 10:08:51 2008 +++ rc.initdiskless Wed Mar 19 11:21:32 2008 @@ -163,6 +163,30 @@ fi } +# Fire up an interface to do nfs-mounts if this machine +# was booted from a md_root +# Use kenv to get the configuration vom dhcp like +# /sys/nfsclient/nfs_vfsops.c does + +ifconfig_kenv() +{ +echo "trying to up an interface with options from kenv..." + +IF=`kenv | grep 'boot.netif.name' | awk 'BEGIN {FS="="} {print $2}' | sed 's/"//g'` +GW=`kenv | grep 'boot.netif.gateway' | awk 'BEGIN {FS="="} {print $2}' | sed 's/"//g'` +IP=`kenv | grep 'boot.netif.ip' | awk 'BEGIN {FS="="} {print $2}' | sed 's/"//g'` +NM=`kenv | grep 'boot.netif.netmask' | awk 'BEGIN {FS="="} {print $2}' | sed 's/"//g'` + +if [ ! "$1" = "$IF" ]; then + return 0 +fi + +echo "kenv: IF=$IF GW=$GW IP=$IP MASK=$NM" +ifconfig $IF $IP netmask $NM up +route add default $GW + +} + # DEBUGGING # # set -v @@ -176,6 +200,12 @@ if [ ${dlv:=0} -ne 0 ] ; then iflist=`ifconfig -l` for i in ${iflist} ; do + + ifconfig ${i} | grep -q inet + if [ $? -ne "0" ] ; then + ifconfig_kenv ${i} + fi + set -- `ifconfig ${i}` while [ $# -ge 1 ] ; do if [ "${bootp_ifc}" = "" -a "$1" = "inet" ] ; then --------------080908080007060209020005--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200803191110.m2JBA2Jt091527>