network init script

Moritz Heiber moe at lunar-linux.org
Wed Jan 21 12:07:23 GMT 2004


Hello,

due to the fact that I had to get in touch with dhcp/routing/network
stuff recently (New laptop arrived and had to be integrated into my
already existing (fairly easy structured) network). Now .. I noticed
that if (for whichever reason possible) the network inititation fails
the network scripts returns [ OK ] where it should return an error. I
haven't found the cause for that problem but for another one I
encoutered:

When taking down the network manually (for me) none of the brought up
network devices is taken down via ifconfig. I examened the network
script and found the following:

case $ADDRESS in
            [dD][hH][cC][pP])
                if [ -z $DHCP_CLIENT ]; then
                    echo "Device $1: missing DHCP client";
                    return -1;
                fi;
                case $DHCP_CLIENT in
                    [dD][hH][cC][pP][cC][dD])
                        PIDFILE=/etc/dhcpc/dhcpcd-$1.pid
                        RUNFILE=/usr/sbin/dhcpcd
                    ;;
                    [dD][hH][cC][lL][iI][eE][nN][tT])
                        PIDFILE=/var/run/dhclient-$1.pid
                        RUNFILE=/sbin/dhclient
                        DHCP_OPTIONS="$DHCP_OPTIONS -pf $PIDFILE -lf
/var/state/dhcp/dhclient-$1.leases"                    ;;
                    [uU][dD][hH][cC][pP][cC])
                        PIDFILE=/var/run/udhcpc-$1.pid
                        RUNFILE=/sbin/udhcpc
                        DHCP_OPTIONS="$DHCP_OPTIONS -p $PIDFILE -i"
                    ;;
                esac
                if [ ! -x $RUNFILE ]; then
                    echo "$DHCP_CLIENT not installed";
                    return -1;
                fi;
                if [ -e $PIDFILE ]; then
                    if [ $(ps ax | grep `cat $PIDFILE` | grep -v grep |
wc -l) -ge 1 ]; then                        echo "Device $1: already
started";                        return -1;
                    else
                        rm -f $PIDFILE;
                    fi;
                fi;
                $RUNFILE $DHCP_OPTIONS $1 >/dev/null 2>&1;
                sleep 1;
                if [ ! -e $PIDFILE ]; then
                    echo "Device $1: DHCP failed";
                    return -1;
                fi;
            ;;

This is from the device_stop() function. As you can see we're looking
for the certain dhcp client and execute `dhcpcd -k` if the dhcpcd client
is used. Now, from my understanding right after that the case function
is closed and ifconfig <device> down is never been executed ever. Maybe
my bash is not good enough and I don't see the pattern ;-) .. but please
give me a hint. Thanks.

Bye,

Moritz

-- 
Moritz Heiber

Lunar Linux developer: http://www.lunar-linux.org
XFce4 desktop environment: http://xfce.org
Moritz Heiber[at]SPLiNe: http://moe.spline.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://dbguin.lunar-linux.org/mailman/private/lunar-dev/attachments/20040121/e8ddf251/attachment.bin


More information about the Lunar-dev mailing list