arp.c (31183) | arp.c (53024) |
---|---|
1/* | 1/* |
2 * arp.c (C) 1995-1997 Darren Reed | 2 * arp.c (C) 1995-1998 Darren Reed |
3 * 4 * Redistribution and use in source and binary forms are permitted 5 * provided that this notice is preserved and due credit is given 6 * to the original author and the contributors. 7 */ 8#if !defined(lint) 9static const char sccsid[] = "@(#)arp.c 1.4 1/11/96 (C)1995 Darren Reed"; | 3 * 4 * Redistribution and use in source and binary forms are permitted 5 * provided that this notice is preserved and due credit is given 6 * to the original author and the contributors. 7 */ 8#if !defined(lint) 9static const char sccsid[] = "@(#)arp.c 1.4 1/11/96 (C)1995 Darren Reed"; |
10static const char rcsid[] = "@(#)$Id: arp.c,v 2.0.2.6 1997/09/28 07:13:25 darrenr Exp $"; | 10static const char rcsid[] = "@(#)$Id: arp.c,v 2.1 1999/08/04 17:31:03 darrenr Exp $"; |
11#endif 12#include <stdio.h> 13#include <errno.h> 14#include <sys/types.h> 15#include <sys/socket.h> 16#if !defined(ultrix) && !defined(hpux) 17#include <sys/sockio.h> 18#endif 19#include <sys/ioctl.h> 20#include <netdb.h> 21#include <netinet/in.h> 22#include <net/if.h> | 11#endif 12#include <stdio.h> 13#include <errno.h> 14#include <sys/types.h> 15#include <sys/socket.h> 16#if !defined(ultrix) && !defined(hpux) 17#include <sys/sockio.h> 18#endif 19#include <sys/ioctl.h> 20#include <netdb.h> 21#include <netinet/in.h> 22#include <net/if.h> |
23#include <netinet/if_ether.h> |
|
23#ifndef ultrix 24#include <net/if_arp.h> 25#endif 26#include <netinet/in.h> 27#include <netinet/ip_var.h> 28#include <netinet/tcp.h> 29#include "ipsend.h" | 24#ifndef ultrix 25#include <net/if_arp.h> 26#endif 27#include <netinet/in.h> 28#include <netinet/ip_var.h> 29#include <netinet/tcp.h> 30#include "ipsend.h" |
31#include "iplang/iplang.h" |
|
30 31 32/* 33 * lookup host and return 34 * its IP address in address 35 * (4 bytes) 36 */ 37int resolve(host, address) --- 28 unchanged lines hidden (view full) --- 66{ 67 static int sfd = -1; 68 static char ethersave[6], ipsave[4]; 69 struct arpreq ar; 70 struct sockaddr_in *sin, san; 71 struct hostent *hp; 72 int fd; 73 | 32 33 34/* 35 * lookup host and return 36 * its IP address in address 37 * (4 bytes) 38 */ 39int resolve(host, address) --- 28 unchanged lines hidden (view full) --- 68{ 69 static int sfd = -1; 70 static char ethersave[6], ipsave[4]; 71 struct arpreq ar; 72 struct sockaddr_in *sin, san; 73 struct hostent *hp; 74 int fd; 75 |
76#ifdef IPSEND 77 if (arp_getipv4(ip, ether) == 0) 78 return 0; 79#endif |
|
74 if (!bcmp(ipsave, ip, 4)) { 75 bcopy(ethersave, ether, 6); 76 return 0; 77 } 78 fd = -1; 79 bzero((char *)&ar, sizeof(ar)); 80 sin = (struct sockaddr_in *)&ar.arp_pa; 81 sin->sin_family = AF_INET; --- 41 unchanged lines hidden --- | 80 if (!bcmp(ipsave, ip, 4)) { 81 bcopy(ethersave, ether, 6); 82 return 0; 83 } 84 fd = -1; 85 bzero((char *)&ar, sizeof(ar)); 86 sin = (struct sockaddr_in *)&ar.arp_pa; 87 sin->sin_family = AF_INET; --- 41 unchanged lines hidden --- |