[patch] [rfc] Re: udhcpc eating too much cpu

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Wed Jan 16 14:28:48 PST 2008


On Sun, 13 Jan 2008, Cristian Ionescu-Idbohrn wrote:

> The problem is described here too:
>
>   http://archives.devshed.com/forums/networking-100/dhclient-raw-socket-2147170.html
>
> We noticed that too (corner cases).  udhcpc eats up to 30% cpu.
> That happens after DISCOVER while waiting for OFFER.  udhcpc is looking
> through every udp package.
>
> I also learned (from one of my collegues) that a LPF/BPF filter will
> most likely help.

[snip]

> I intend to try that during the comming weeks, if noone else beats me to
> it ;)

And this is what I could come up with (attached). Besides the actual
LPF-filter in networking/udhcp/clientsocket.c, I thought it was wise to
move SERVER_PORT and CLIENT_PORT from networking/udhcp/options.h to
networking/udhcp/common.h and adjust some other file(s) accordingly.  The
rest is just whitespace damage fixes.

This patch reduces udhcpc CPU-consumption (when the dhcp-server(s) is/are
unresponsive) on our board from 10-30% down to 0% (as shown by bb-top).

Besides messages like "bogous packet" and "oversized packet" (don't
remember the exact wording and I'm too lazy to look them up again, but
can be reproduced with DEBUG enebled and running udhcpc in the foreground)
do no longer show up in the console.

The comment in networking/udhcp/clientsocket.c gives credit to Stefan
Rompf <sux at loplof.de>, I've shamelessly stolen the LPF/BPF-filter from.
I hereby aknowledge his involuntary contribution to this project :)  I
don't think there should be any copyright and/or licensing problems here.

Stefan (if reachable) will probably comment.

In my big comment inside networking/udhcp/clientsocket.c I'm also trying
to pinpoint some ideas that I'm very fond of and Stefan puts words on.  I
think those ideas (if implemented in busybox) would be a big lift for this
project, namely:  netlink events and server reconfiguration without
restarts, SIGHUPs, complicates scripts, resource drains especially for
embedded systems, and so on.


Cheers,

-- 
Cristian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bb-svn-udhcp.patch
Type: text/x-diff
Size: 5583 bytes
Desc: 
Url : http://busybox.net/lists/busybox/attachments/20080116/a3bf7234/attachment.bin 


More information about the busybox mailing list