Messages in this thread | | | From | costas <> | Subject | problem with ioctl SIOCSARP or is it? | Date | Wed, 6 Mar 2002 17:42:11 +0000 |
| |
Hi, can anybody from the linux kernel developers tell me what is wrong with proxy arp in kernel 2.4. I just want to configure my machine so as to act as an arp proxy. When I do arp -s <ipaddr> <hwaddr> pub the kernel adds the following line to my arp cache: Address HWtype HWaddress Flags Mask Iface ipaddr * * MP eth0 and when I am trying to ping the newly configured node I receive destination unrichable message. On the other hand I have the following programme which is supposed to do the same task, however it adds exactly the same entry in the arp cache, and I have also the same result as before when I try to ping the new node
int main(argc, argv) int argc; char **argv; { int tunfd; IP_addr ip_addr; struct ifreq ifreq; struct arpreq arp; struct ether_addr ea; struct sockaddr_in *paddr;
if( argc != 2){ printf("Usage: tunnel <IP ADDRESS>\n"); exit(1); }
if( (inet_pton(AF_INET, *(argv + 1), &ip_addr)) < 0) err_sys("inet_pton error");
if( (tunfd = socket(PF_INET, SOCK_DGRAM, 0)) < 0) err_sys("socket error");
strcpy(ifreq.ifr_name, "eth0"); if( ioctl(tunfd, SIOCGIFHWADDR, &ifreq)) err_sys("ioctl error");
memcpy(&ea, ifreq.ifr_hwaddr.sa_data, ETH_ALEN);
memset(&arp, 0x00, sizeof(arp));
paddr = (struct sockaddr_in*) &arp.arp_pa; bzero(paddr, sizeof(Sockaddr_in)); paddr->sin_family = AF_INET; memcpy(&paddr->sin_addr, &ip_addr, sizeof(IP_addr));
arp.arp_ha.sa_family = ARPHRD_ETHER; /*I tryied also AF_UNSPEC*/
memcpy(arp.arp_ha.sa_data, ea.ether_addr_octet, ETH_ALEN);
arp.arp_flags |= ATF_PUBL;
strcpy(arp.arp_dev, "eth0");
if( ioctl(tunfd, SIOCSARP, &arp)) err_sys("ioctl error");
if(close(tunfd)) err_sys("close error");
return 0; }
All I want to know is if there is a problem with ioctl SIOCSARP. Is there any other way to add entries to my arp cache? I heard about netlink sockets but except the manual page I found nothing else. Regards Costas
PS1. The net.ipv4.conf.all.proxy_arp flag is set. PS2. I subscribed to the kernel mailing list a few hours ago but still haven't received any mail, so please if somebody answers include me in the cc: Cheers - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |