[patch] [rfc] udhcpc eating too much cpu

Stefan Rompf stefan at loplof.de
Fri Jan 18 08:23:25 PST 2008


Am Donnerstag, 17. Januar 2008 16:49 schrieb Cristian Ionescu-Idbohrn:

> 	if (setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter_prog,
> 		       sizeof(filter_prog)) < 0) {
> 		if (errno != ENOPROTOOPT)
> 			bb_perror_msg_and_die("setsockopt");
> 		bb_perror_msg("setsockopt filter");
> 	} else
> 		DEBUG("attached filter to raw socket fdr %d", fd);
>
> should take care of that, shouldn't it?

this should work.

>   (void)setsockopt(sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter,
> sizeof(filter));
>
> No error checking at all.

Feature ;-) I knew some failures were ok, didn't want to distinguish and safe 
every byte. But I've taken a look at 2.6.0, it already includes BPF 
unconditionally. So I can add a check here.

Btw, I'll also take your BPF change to check both source and destination port, 
this definitely make sense. Thanks!

Stefan


More information about the busybox mailing list