[PATCH] add IP check functionality to udhcpc

Denys Vlasenko vda.linux at googlemail.com
Thu Nov 22 21:34:08 UTC 2007


On Thursday 22 November 2007 01:02, Jonas Danielsson wrote:
> Denys Vlasenko wrote:
> > Had to edit it quite a bit. You added #include's which were not needed.
> > You removed memcmp without explaining why.
> > send_decline()'s stype was different from surrounding code.
> >
> > +static int arpcheck = 0;
> > +static int decline_wait = 10;
> >
> > These statics are not needed, local variables will work as well.
> >
> > I fixed these things, and possibly added my own bugs ;)
> >
> > Please test attached patch, is it still doing what you need?
> >
> > Question: do you really need "-W seconds"?
> > Why not reuse "-A seconds" value?
> > --
> > vda
>
> Hi vda,
>
> The patch still does what I need. Thanks alot for your comments and
> modifications!
> But I had problems building it at first. Could you explain to me what
> this snippet does?
>
> UDHCPC_NEEDS_ARPING-$(CONFIG_FEATURE_UDHCPC_ARPING) = y
> lib-$(UDHCPC_NEEDS_ARPING)      += arpping.o
>
> The build process failed to link in arpping.o for me so I had to work
> around it to make it
> compile. I can't find any other references to UDHCPC_NEEDS_ARPING in the
> codebase.

Yes. '-y' was missing here:

lib-$(UDHCPC_NEEDS_ARPING-y)    += arpping.o


> About the -W seconds. I added it because of what was pointed out in the
> RFC2131:
>
> 5.   The client receives the DHCPACK message with configuration
>      parameters.  The client SHOULD perform a final check on the
>      parameters (e.g., ARP for allocated network address), and notes the
>      duration of the lease specified in the DHCPACK message.  At this
>      point, the client is configured.  If the client detects that the
>      address is already in use (e.g., through the use of ARP), the
>      client MUST send a DHCPDECLINE message to the server and restarts
>      the configuration process.  The client SHOULD wait a minimum of ten
>      seconds before restarting the configuration process to avoid
>      excessive network traffic in case of looping.
>
>
> It is the matter of the minimum of 10 seconds that made me include it.
> But maybe it is better to reuse the --tryagain flag
> and set a lower bound on it?

I modified the source to reuse that. We already have too many options,
need to conserve them ;)

Please try attached version.
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dhcpc.c
Type: text/x-csrc
Size: 17038 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20071122/15e60c86/attachment-0002.c 


More information about the busybox mailing list