udhcpc is disrespecting --retries, unless -n is passed as well

Denys Vlasenko vda.linux at googlemail.com
Thu Aug 8 07:48:40 UTC 2013


On Tue, Aug 6, 2013 at 9:44 AM, John Spencer
<maillist-busybox at barfooze.de> wrote:
> udhpc is looping forever witout respecting the number of retries given.
> only passing -n makes it exit after the max number of retries.

$ udhcpc --help
BusyBox v1.22.0.git (2013-07-30 11:58:43 CEST) multi-call binary.

Usage: udhcpc [-fbnqvoCRB] [-i IFACE] [-r IP] [-s PROG] [-p PIDFILE]
	[-V VENDOR] [-x OPT:VAL]... [-O OPT]... [-P N]

	-i,--interface IFACE	Interface to use (default eth0)
	-p,--pidfile FILE	Create pidfile
	-s,--script PROG	Run PROG at DHCP events (default
/usr/share/udhcpc/default.script)
	-B,--broadcast		Request broadcast replies
	-t,--retries N		Send up to N discover packets
	-T,--timeout N		Pause between packets (default 3 seconds)
	-A,--tryagain N		Wait N seconds after failure (default 20)
	-f,--foreground		Run in foreground
	-b,--background		Background if lease is not obtained
	-n,--now		Exit if lease is not obtained
        ...

The "-t N" option doesn't say how many times to try acquiring
the lease before exiting. It says how many discover packets to send.

> this is pretty counterintuitive.

How would you rephrase the help text to make it clearer?

> anyway: here's the proposed patch:

I prefer to retain current logic: if you want to exit on failure,
use -n. Otherwise all current users of "-t N" will have
their setups broken.
-- 
vda


More information about the busybox mailing list