udhcpc and leases

Paul Fox pgf at brightstareng.com
Wed Nov 7 14:03:02 UTC 2007


 > I'm looking into getting UDHCPC working again on my x86
 > embedded PC.  If I can't get a lease, I would like to use
 > ZCIP, otherwise use the IP that we were given.
 > 
 > I'm using BB 1.8.0 with a very simple script to just print
 > what it's supposed to do.  I've also enabled debugging for
 > udhcpc.  When udhcpc gets a lease from the DHCP server it
 > exits immediately.

are you sure it's exiting, or has it gone into the background?
 > 
 > # udhcpc -s ./udhcp.script
 > -> deconfig
 > -> bound
 > entering none listen mode

at roughly line 504 of dhcpc.c, after getting an address, the
client goes into "listen none" mode, and then puts itself into
the background.  suppress the latter behavior with "-f".

 > 
 > When reading through the source code I find:
 > 
 > int udhcpc_main(int argc, char **argv)
 > {
 >     ...
 >         if (opt & OPT_q)
 >                 client_config.quit_after_lease = 1;
 >     ...
 > }
 > 
 > but I don't find where "client_config_quit_after_lease" is initialised to 0.

client_config is an external global which is guaranteed to be zero when
the applet starts.

 > 
 > What happens when the lease expires?  How am I supposed to
 > renegotiate a new lease?

you would benefit from reading an overview of the dhcp protocol. 
your questions (though good ones) are going beyond the scope of
this list, i'm afraid.  (short answer:  the lease won't expire if your
client keeps renewing it.)

paul
=---------------------
 paul fox, pgf at brightstareng.com



More information about the busybox mailing list