DHCP server not present at startup

Denys Vlasenko vda.linux at googlemail.com
Wed Jun 17 12:18:37 UTC 2009


On Wed, Jun 17, 2009 at 12:06 PM, Rajat Sharma<sharmarajat14 at gmail.com> wrote:
> HI,
>
> I am trying to integerate avahi-autoipd with udhcpc.
> Avavi-autoipd is started from the script when a deconfig event is received.
>
> I want to know that at bootup time if there is no DHCP server available then
> will the udhcpc send any event
> to the script or it will keep on trying to discover the DHCP server.(
> options -n & -q are not set).

The code which is responsible for this is here:

 leasefail:
                                udhcp_run_script(NULL, "leasefail");
#if BB_MMU /* -b is not supported on NOMMU */
                                if (opt & OPT_b) { /* background if no lease */
                                        bb_info_msg("No lease, forking
to background");
                                        client_background();
                                        /* do not background again! */
                                        opt = ((opt & ~OPT_b) | OPT_f);
                                } else
#endif
                                if (opt & OPT_n) { /* abort if no lease */
                                        bb_info_msg("No lease, failing");
                                        retval = 1;
                                        goto ret;
                                }
                                /* wait before trying again */
                                timeout = tryagain_timeout;
                                packet_num = 0;
                                continue;

AFAIKS, "leasefail" event is sent if DHCP server times out,
and without -n, udhcpc will continue trying to find it.
--
vda


More information about the busybox mailing list