udhcpc eating too much cpu

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Sat Jan 26 19:49:18 UTC 2008


On Fri, 25 Jan 2008, Denis Vlasenko wrote:

> On Friday 25 January 2008 14:02, Cristian Ionescu-Idbohrn wrote:
> >
> > Is there anything I can do to attract more attention to the patch I
> > sent which cures the problem mentioned above?
>
> Sorry, I was (and still is) busy with job search.

No worries, good luck with your search.

> --- networking/udhcp.orig/clientsocket.c        2006-12-20 08:30:32.000000000 +0100
> +++ networking/udhcp.mine/clientsocket.c        2008-01-17 14:11:21.000000000 +0100
>
> This applies only with patch -p2 inside networking/udhcp.

Sorry about that.

> Typically patches are applied with patch -p1 or
> patch -p0 from top-level directory.

Yes.  Generate patch for -p0 was my initial intention.  I just forgot to
remove .orig and .mine from the paths.  I'l try to be more careful.

> This data should be static and const:

That's fine.

>         static const struct sock_filter filter_instr[] = {
>                 /* check for udp */
>                 BPF_STMT(BPF_LD|BPF_B|BPF_ABS, 9),
>                 BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, IPPROTO_UDP, 2, 0),     /* L5, L1, is UDP? */
>                 /* ugly check for arp on ethernet-like and IPv4 */
>                 BPF_STMT(BPF_LD|BPF_W|BPF_ABS, 2),                      /* L1: */
>                 BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, 0x08000604, 3, 4),      /* L3, L4 */
>                 /* skip IP header */
>                 BPF_STMT(BPF_LDX|BPF_B|BPF_MSH, 0),                     /* L5: */
>                 /* check udp source and destination ports */
>                 BPF_STMT(BPF_LD|BPF_W|BPF_IND, 0),
>                 BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, SERVER_AND_CLIENT_PORTS, 0, 1), /* L3, L4 */
>                 /* returns */
>                 BPF_STMT(BPF_RET|BPF_K, ~0UL),                          /* L3: pass */
>                 BPF_STMT(BPF_RET|BPF_K, 0),                             /* L4: reject */
>         };
>         static const struct sock_fprog filter_prog = {
>                 .len =  sizeof(filter_instr) / sizeof(filter_instr[0]),
>                 /* casting const away: */
>                 .filter = (struct sock_filter*) filter_instr,
>         };
>
> And God bless that poor soul which will need to understand what is it
> all about...

Yes.  I'll have to document that better.  I promise to come back with a
new patch.

> Any pointers to docs?

Unfortunatelly no.  Grey zone ;)  I couldn't find much.  But one of my
collegues (the secret one ;) is good at that.

There's something similar (but not quite) in ISC's dhcp3-3.0.6,
common/bpf.c.  Look for USE_BPF_RECEIVE, USE_LPF_RECEIVE, dhcp_bpf_filter.

> I am applying it to svn.


Cheers,

-- 
Cristian



More information about the busybox mailing list