udhcpd not starting
Denys Vlasenko
vda.linux at googlemail.com
Thu Oct 8 19:38:21 UTC 2009
On Thursday 08 October 2009 14:11, Ruben Lagar wrote:
> Hello everybody,
> I have successfully cross-compiled busybox for an arm processor. Now I am
> trying to run udhcpd with a very basic config file
>
>
> *start ** **10.0.1.100** *
> *end** **10.0.1.120** *
> *interface** **usb0** *
> *max_leases** **21** *
> *lease_file** **/etc/udhcpd.leases** *
> *pidfile** **/etc/udhcpd.pid** *
> *option** **subnet** **255.255.255.0*
> *option** **domain** **local*
> *option** **lease** **864000*
>
> But when I try to run it, I get an error:
>
> udhcpd (v1.14.1) started
> *udhcpd: can't bind to interface usb0: Protocol not available*
>
> I have been Googling it, and it looks like some Kernel problem or similar,
> but haven't found exactly what is going on.
>
> Has anyone get this error before? Is there any way around it?
Here is where it comes from:
int FAST_FUNC setsockopt_bindtodevice(int fd, const char *iface)
{
int r;
struct ifreq ifr;
strncpy_IFNAMSIZ(ifr.ifr_name, iface);
/* NB: passing (iface, strlen(iface) + 1) does not work!
* (maybe it works on _some_ kernels, but not on 2.6.26)
* Actually, ifr_name is at offset 0, and in practice
* just giving char[IFNAMSIZ] instead of struct ifreq works too.
* But just in case it's not true on some obscure arch... */
r = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr));
if (r)
bb_perror_msg("can't bind to interface %s", iface);
return r;
}
A few shots in the dark:
(1) Is af_packet built (CONFIG_FILTER=y/m)? If it's a module (m, not y),
is it inserted?
(2) Do you run udhcpd as root?
(3) Try adding "memset(&ifr, 0, sizeof(ifr));" before strncpy_IFNAMSIZ.
--
vda
More information about the busybox
mailing list