[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: issue with detecting the right interface

On Sun, 4 Sep 2011 16:25:11 -0700
Kash <melbogia@gmail.com> wrote:

> Ok, I figured out why that code wasn't running. It skips the code that
> iterates over all the interface because I have netboot=nfs in my
> pxelinux stanza. But it's looking for all these to be null for that
> code to run
>   if [ -z "${NETBOOT}" ] && [ -z "${FETCH}" ] && \
>      [ -z "${HTTPFS}" ] && [ -z "${FTPFS}" ]
>   then
> I don't know why, it checks for these conditions, and shouldn't
> netboot=nfs needs to be there? I took it out to test and it doesn't
> like it and fails miserably. After it skips that code, it tries to get
> a DHCP on the first NIC with a link which isn't right.
> The following snippet is from  scripts/live-premount/select_eth_device
> ..
>   for step in 1 2 3 4 5; do
>     for interface in $l_interfaces; do
>       carrier=$(cat /sys/class/net/$interface/carrier \
>         2>/dev/null)
>       # link detected
>       if [ "$carrier" = 1 ]; then
>         echo " found $interface."
>         # inform initrd's init script :
>         echo "DEVICE=$interface" >> /conf/param.conf
>         exit 0
>       fi
>     done
>     # wait a bit
>     sleep 1
>   done
> ...
> It puts the first interface it finds with a link in conf/param.conf
> and then exits. That is not right, in our case anyway, because we
> could potentially have more then one interface with a link but only
> one of the interface is on the network with a DHCP server running on
> it. Now conf/param.conf has the the wrong interface and it runs
> ipconfig on it and gets stuck there.
> ipconfig ${DEVICE} | tee /netboot.config
> Kashif
Good work!
Yep. that has got to be it.

I think the first test is to handle the case where its more critical/noticeable
The cases tested for are the (only?) cases where boot can not continue without
an IP.

I was going on the assumption that select_eth_device has a poor check for
a network interface ( gets ethX but misses wlanX, otherX), and it only finds the
first. the check in live allows for multiple NICs, of other types. I think if
its in the /sys/class/net directory it is ok to assume that its some kind of
network but there are other virtual devices there....
so the other part of the patch may be the attached.

Attachment: p
Description: Binary data

Reply to: