Hi, I am trying to play with SIOCGARP. Here is the program #include <sys/socket.h> #include <netinet/in.h> #include <net/if_arp.h> #include <stdio.h> #include <errno.h> #include <sys/ioctl.h> #include <arpa/inet.h> #include <string.h> #define IP "62.4.22.236" #define INTERFACE "eth1" int main(int argc, char ** argv) { int s; struct arpreq a; struct sockaddr_in * sin; if ((s = socket(AF_INET,SOCK_DGRAM,0) == -1)) { perror("socket"); return -1; } memset(&a,0,sizeof(a)); strcpy(a.arp_dev,INTERFACE); sin = (struct sockaddr_in *) &(a.arp_pa); sin->sin_family = AF_INET; if (! inet_aton(IP,&sin->sin_addr)) { puts("Cannot convert " IP "."); return -1; } if (ioctl(s,SIOCGARP,&a)) { perror("ioctl"); return -1; } printf("HWADDR: %x\n",*a.arp_ha.sa_data); return 0; } ioctl always returns EINVAL. I've looked at net/ipv4/arp.c, I don't see how this is possible. Could anyone tell me what I am missing ? TIA. -- Guillaume Morin <guillaume@morinfr.org> La vie est facétieuse - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html