[ add hpa on cc ]

On Sun, 28 Jun 2009, Vagrant Cascadian wrote:

> On Sun, Jun 28, 2009 at 11:51:32PM +0100, Ben Hutchings wrote:
> > On Sun, 2009-06-28 at 14:50 -0700, Vagrant Cascadian wrote:
> > > Package: initramfs-tools
> > > Version: 0.93.3
> > > Severity: wishlist
> > > Tags: patch
> > > 
> > > when booting thin clients with multiple network cards, 
> > > initramfs-tools/ipconfig
> > > have a hard time figuring out which interface to use. attached is a patch 
> > > which
> > > sets DEVICE to the interface matching the mac address that pxelinux 
> > > passes when
> > > using the IPAPPEND 2 or 3 options.
> > 
> > This sounds reasonable, but your patch makes unnecessary use of several
> > commands.
> > 
> > > diff --git a/scripts/functions b/scripts/functions
> > > index 77de8f3..ec0ffd2 100644
> > > --- a/scripts/functions
> > > +++ b/scripts/functions
> > > @@ -258,6 +258,19 @@ parse_numeric() {
> > >  
> > >  configure_networking()
> > >  {
> > > +
> > > + # pxelinux sets BOOTIF to a value based on the mac address of the 
> > > network
> > > + # card used to PXE boot, so use this value for DEVICE rather than a
> > > + # hard-coded device name from initramfs.conf. this facilitates network
> > > + # booting when machines may have multiple network cards.
> > > + if [ -n "${BOOTIF}" ]; then
> > > +         normal_mac=$(echo $BOOTIF | sed -e 's,^01-,,g' -e 's,-,:,g' | 
> > > tr [a-z] [A-Z])
> > 
> > You can use sed's y/// command instead of piping to tr.
> > 
> > > +         new_device=$(ifconfig -a | awk "/$normal_mac/"'{print $1}')
> > [...]
> > 
> > You can use the files /sys/class/net/*/address instead of ifconfig.

and what if there is no sed in initramfs.

can pxelinux output BOOTIF in sysfs format?
 
> thanks for the suggestions, updated patch:
> 
> diff --git a/scripts/functions b/scripts/functions
> index 77de8f3..f99e779 100644
> --- a/scripts/functions
> +++ b/scripts/functions
> @@ -258,6 +258,25 @@ parse_numeric() {
>  
>  configure_networking()
>  {
> +
> +     # pxelinux sets BOOTIF to a value based on the mac address of the
> +     # network card used to PXE boot, so use this value for DEVICE rather
> +     # than a hard-coded device name from initramfs.conf. this facilitates
> +     # network booting when machines may have multiple network cards.
> +     # pxelinux sets BOOTIF to 01-$mac_address
> +     if [ -n "${BOOTIF}" ]; then
> +             bootif_mac=$(echo ${BOOTIF#*-} | sed -e 'y,-,:,')
> +             for device in /sys/class/net/* ; do
> +                     if [ -f "$device/address" ]; then
> +                             current_mac=$(cat "$device/address")
> +                             if [ "$bootif_mac" = "$current_mac" ]; then
> +                                     DEVICE=${device##*/}
> +                                     break
> +                             fi
> +                     fi
> +             done
> +     fi
> +
>       # networking already configured thus bail out
>       [ -n "${DEVICE}" ] && [ -e /tmp/net-"${DEVICE}".conf ] && return 0
>  
> 
> live well,
>   vagrant
> 

thanks

-- 
maks



-- 
To UNSUBSCRIBE, email to debian-kernel-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to