FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Kernel

 
 
LinkBack Thread Tools
 
Old 03-29-2010, 04:23 AM
Vagrant Cascadian
 
Default Bug#575766: initramfs-tools: configure_networking function fails if no DEVICE is specified

Package: initramfs-tools
Severity: normal
Tags: patch

the configure_networking function relies on DEVICE being set, and
conf/initramfs.conf hard-codes this to eth0. though some scripts may call this
from /scripts/local-top, and DEVICE may not be set. even when it is set, it
hard-coding it to eth0 may be the wrong network interface.

the following patch should partially address this by checking for DEVICE when
not defined, and using the first interface with an active link.

diff --git a/conf/initramfs.conf b/conf/initramfs.conf
index 23dd249..471dfea 100644
--- a/conf/initramfs.conf
+++ b/conf/initramfs.conf
@@ -55,7 +55,7 @@ BOOT=local
# Specify the network interface, like eth0
#

-DEVICE=eth0
+#DEVICE=eth0

#
# NFSROOT: [ auto | HOST:MOUNT ]
diff --git a/scripts/functions b/scripts/functions
index 0ecb1d6..5444c11 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -294,6 +294,24 @@ configure_networking()
done
fi

+ if [ -z "${DEVICE}" ]; then
+ # attempt to detect the first device with an established link.
+ for net_device_path in /sys/class/net/* ; do
+ net_device=${net_device_path##*/}
+ case $net_device in
+ lo) ;;
+ *)
+ if read carrier < "$net_device_path/carrier" ; then
+ if [ "$carrier" = "1" ]; then
+ DEVICE="$net_device"
+ break
+ fi
+ fi
+ ;;
+ esac
+ done
+ fi
+
# networking already configured thus bail out
[ -n "${DEVICE}" ] && [ -e /tmp/net-"${DEVICE}".conf ] && return 0


live well,
vagrant



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100329042325.GF27790@claws.fglan">http://lists.debian.org/20100329042325.GF27790@claws.fglan
 
Old 04-04-2010, 12:32 AM
maximilian attems
 
Default Bug#575766: initramfs-tools: configure_networking function fails if no DEVICE is specified

On Sun, 28 Mar 2010, Vagrant Cascadian wrote:

> the configure_networking function relies on DEVICE being set, and
> conf/initramfs.conf hard-codes this to eth0. though some scripts may call this
> from /scripts/local-top, and DEVICE may not be set. even when it is set, it
> hard-coding it to eth0 may be the wrong network interface.
>
> the following patch should partially address this by checking for DEVICE when
> not defined, and using the first interface with an active link.

this looks very similar to #566295

did you have a look at the proposed patch of
http://bugs.debian.org/566295

thanks

> diff --git a/conf/initramfs.conf b/conf/initramfs.conf
> index 23dd249..471dfea 100644
> --- a/conf/initramfs.conf
> +++ b/conf/initramfs.conf
> @@ -55,7 +55,7 @@ BOOT=local
> # Specify the network interface, like eth0
> #
>
> -DEVICE=eth0
> +#DEVICE=eth0
>
> #
> # NFSROOT: [ auto | HOST:MOUNT ]
> diff --git a/scripts/functions b/scripts/functions
> index 0ecb1d6..5444c11 100644
> --- a/scripts/functions
> +++ b/scripts/functions
> @@ -294,6 +294,24 @@ configure_networking()
> done
> fi
>
> + if [ -z "${DEVICE}" ]; then
> + # attempt to detect the first device with an established link.
> + for net_device_path in /sys/class/net/* ; do
> + net_device=${net_device_path##*/}
> + case $net_device in
> + lo) ;;
> + *)
> + if read carrier < "$net_device_path/carrier" ; then
> + if [ "$carrier" = "1" ]; then
> + DEVICE="$net_device"
> + break
> + fi
> + fi
> + ;;
> + esac
> + done
> + fi
> +
> # networking already configured thus bail out
> [ -n "${DEVICE}" ] && [ -e /tmp/net-"${DEVICE}".conf ] && return 0
>
>
> live well,
> vagrant
>
>
--
maks



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100404003243.GH6199@stro.at">http://lists.debian.org/20100404003243.GH6199@stro.at
 
Old 04-10-2010, 04:33 AM
Vagrant Cascadian
 
Default Bug#575766: initramfs-tools: configure_networking function fails if no DEVICE is specified

On Sun, Apr 04, 2010 at 02:32:43AM +0200, maximilian attems wrote:
> On Sun, 28 Mar 2010, Vagrant Cascadian wrote:
>
> > the configure_networking function relies on DEVICE being set, and
> > conf/initramfs.conf hard-codes this to eth0. though some scripts may call this
> > from /scripts/local-top, and DEVICE may not be set. even when it is set, it
> > hard-coding it to eth0 may be the wrong network interface.
> >
> > the following patch should partially address this by checking for DEVICE when
> > not defined, and using the first interface with an active link.
>
> this looks very similar to #566295
>
> did you have a look at the proposed patch of
> http://bugs.debian.org/566295

yes, that addresses the issue much more simply. i'd recommend going with that
instead of my patch.

live well,
vagrant



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100410043322.GK27790@claws.fglan">http://lists.debian.org/20100410043322.GK27790@claws.fglan
 

Thread Tools




All times are GMT. The time now is 11:11 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org