ISC DHCP on arm not working, error misleading
Mukund Deshpande
sai.mukund.sagar at gmail.com
Fri Dec 2 06:37:47 UTC 2011
Hi All,
Earlier i was getting this error on running dhcp on arm box (Cross Compiled
linux code for arm.., Cross Compiled dhcp)
make
sure
CONFIG_PACKET (Packet socket) and CONFIG_FILTER
(Socket Filtering) are enabled in your kernel
configuration!
This error is totally misleading as i have kernel 2.6.31 on my box and
CONFIG_FILTER is enabled by default and Config_packet is also enabled.
So, In "net/packet/af_packet.c" , I have put some debug message in
kernel...so that we get what the error is.
static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int
addr_len)
{
struct sockaddr_ll *sll = (struct sockaddr_ll*)uaddr;
struct sock *sk=sock->sk;
struct net_device *dev = NULL;
int err;
/*
* Check legality
*/
if (addr_len < sizeof(struct sockaddr_ll))
{
printk("packet_bind: invalid len %d %d\n", addr_len,
sizeof(struct sockaddr_ll)); >>>>>>>> ADDED one print here
return -EINVAL;
}
if (sll->sll_family != AF_PACKET)
{
printk("packet_bind: invalid socket family %d %d\n",
sll->sll_family, AF_PACKET); >>>>>>>> ADDED one print here
return -EINVAL;
}
if (sll->sll_ifindex) {
err = -ENODEV;
dev = dev_get_by_index(sock_net(sk), sll->sll_ifindex);
if (dev == NULL)
goto out;
}
Also Added extra print in the dhcp code in common/lpf.c
if (bind (sock, &sa, sizeof sa)) {
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
errno == EAFNOSUPPORT || errno == EINVAL) {
log_error ("socket: Error_2 (Bind to the interface
name) %m , %d %d %s- make sure", errno, sizeof ll, (char *)info -> ifp);
log_error ("CONFIG_PACKET (Packet socket) %s",
"and CONFIG_FILTER");
log_error ("(Socket Filtering) are enabled %s",
"in your kernel");
log_fatal ("configuration!");
Got the output as
Internet Systems Consortium DHCP Server 4.2.2
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Wrote 0 leases to leases file.
packet_bind: invalid len 16
20
>>>>>>>> The lengths are different..
socket: Error_2 (Bind to the interface name) Invalid argument , 22 16-
make >>>>>>> 22 is Invalid Argument code (EINVAL) >>> 16 is
packet size.
sure
CONFIG_PACKET (Packet socket) and CONFIG_FILTER
(Socket Filtering) are enabled in your kernel
configuration!
You can find this """packet_bind: invalid len 16 20 """
addr_len is 16 and size of sockaddr_ll is 20 hence its failing!!!!
Any pointers as to why its different? sizeof sa passed in bind is 16
whereas it has to be 20...
One way i see is if i use sockaddr_ll in dhcp code (in common/lpf.c)instead
of sockaddr it may work.
Can any one tell me if this would be a good way to get it work??
--
Regards,
Mukund
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20111202/95a504e5/attachment.html>
More information about the dhcp-users
mailing list