FS#216 - RC.SHUTDOWN: ifdown() dhcp fix

Attached to Project: Arch Linux
Opened by Chris Rainey (marin_linuxer) - Wednesday, 22 October 2003, 18:38 GMT
Last edited by Judd Vinet (judd) - Tuesday, 30 December 2003, 22:18 GMT
Task Type Bug Report
Category System
Status Closed
Assigned To Judd Vinet (judd)
Architecture All
Severity Low
Priority Normal
Reported Version 0.6 Widget
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

Hi Judd,

This has been a pickle for me for some time(see http://bbs.archlinux.org/viewtopic.php?t=1579). I'm assuming that I'm not alone in the use of a consumer-grade Wi-Fi router, here, at home. These devices seem to be preset(and some are not adjustable) to long/infinite dhcp lease-times. Apparently the 'dhcpcd' kills itself if a long/infinite lease is acquired. So, as a result, a very repremanding message is produced during ifdown() in rc.d/network when a .pid is not found. I am submitting this request as a 'cosmetic' fix, but for which I believe adds additional 'polish/professionalism' to Arch and especially to nOOb's who might be confounded by it(or worst-case ... made to feel apprehensive about the stability of other inner-workings). You'll have to evaluate my 'fix' as my 'best-guess'. It would seem to suffice, since, the '*.pid' would automatically be removed upon next boot by the ifup() earlier in the script. Please let me know if I am blundering into territory I know nothing about ... :)

(Please also consider adjsting 'dhcpcd -t 10' to 'dhcpcd -t 20'(as shown, below) for those of us using pcmcia Wi-Fi cards which need a few extra seconds to initialize during the boot sequence before being ready to acquire dhcp signal)


FIX:

ifup()
{
varname="\$${1}"
eval new_ifline=$varname
if [ "$new_ifline" = "dhcp" ]; then
# remove the .pid file if it exists
rm -f /etc/dhcpc/dhcpcd-${1}.{pid,cache} >/dev/null 2>&1
/usr/sbin/dhcpcd -t 20 -h $HOSTNAME $1
else
/sbin/ifconfig $new_ifline
fi
return $?
}

ifdown()
{
varname="\$${1}"
eval new_ifline=$varname
if [ "$new_ifline" = "dhcp" ]; then
return $?
else
/sbin/ifconfig $new_ifline down
fi
return $?
}


Thanx, Chris.
This task depends upon

Closed by  Anonymous Submitter
Tuesday, 30 December 2003, 22:18 GMT
Reason for closing:  Fixed
Comment by Chris Rainey (marin_linuxer) - Friday, 14 November 2003, 00:18 GMT
I have realized that I'm wrong in asking for additional time for the dhcpc to aquire a lease from router by adjusting: /usr/sbin/dhcpcd -t 20

It seems, that, the pcmcia interface/module needs the extra time to initialize the wi-fi card. I'm wondering if there is some sort of 'delay' or 'pause' that can be worked into the network ifup() in order to allow pcmcia cards additional time to initialize and therefore be ready to accept instructions for dhcp, etc.?
Comment by Chris Rainey (marin_linuxer) - Tuesday, 18 November 2003, 21:11 GMT
OK, so in fiddling around I think I have a better suggestion for the need to give certain PCMCIA Wi-Fi cards extra time after the pcmcia-cs daemon launches to fully initialise: add a SLEEP command near end of start()

#/etc/rc.d/pcmcia

[snip]

start)

[snip]

else
if [ -r $RUN/stab ] ; then
cat $RUN/stab | cleanup
fi
/sbin/cardmgr $CARDMGR_OPTS
fi

sleep 10

stat_done
;;
Comment by Judd Vinet (judd) - Tuesday, 30 December 2003, 22:18 GMT
  • Task details edited
Okay, I've added a cosmetic fix to rc.d/network, and a small (3 second -- let me know if it's not sufficient) delay to rc.d/pcmcia after starting cardmgr.

Loading...