arp.c (26119) | arp.c (31183) |
---|---|
1/* | 1/* |
2 * arp.c (C) 1995 Darren Reed | 2 * arp.c (C) 1995-1997 Darren Reed |
3 * | 3 * |
4 * The author provides this program as-is, with no gaurantee for its 5 * suitability for any specific purpose. The author takes no responsibility 6 * for the misuse/abuse of this program and provides it for the sole purpose 7 * of testing packet filter policies. This file maybe distributed freely 8 * providing it is not modified and that this notice remains in tact. | 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. |
9 */ | 7 */ |
10#if !defined(lint) && defined(LIBC_SCCS) 11static char sccsid[] = "@(#)arp.c 1.4 1/11/96 (C)1995 Darren Reed"; | 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 $"; |
12#endif 13#include <stdio.h> 14#include <errno.h> 15#include <sys/types.h> 16#include <sys/socket.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> | 17#include <sys/sockio.h> |
18#endif |
|
18#include <sys/ioctl.h> 19#include <netdb.h> 20#include <netinet/in.h> 21#include <net/if.h> | 19#include <sys/ioctl.h> 20#include <netdb.h> 21#include <netinet/in.h> 22#include <net/if.h> |
23#ifndef ultrix |
|
22#include <net/if_arp.h> | 24#include <net/if_arp.h> |
25#endif |
|
23#include <netinet/in.h> 24#include <netinet/ip_var.h> 25#include <netinet/tcp.h> 26#include "ipsend.h" 27 28 29/* 30 * lookup host and return --- 41 unchanged lines hidden (view full) --- 72 bcopy(ethersave, ether, 6); 73 return 0; 74 } 75 fd = -1; 76 bzero((char *)&ar, sizeof(ar)); 77 sin = (struct sockaddr_in *)&ar.arp_pa; 78 sin->sin_family = AF_INET; 79 bcopy(ip, (char *)&sin->sin_addr.s_addr, 4); | 26#include <netinet/in.h> 27#include <netinet/ip_var.h> 28#include <netinet/tcp.h> 29#include "ipsend.h" 30 31 32/* 33 * lookup host and return --- 41 unchanged lines hidden (view full) --- 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; 82 bcopy(ip, (char *)&sin->sin_addr.s_addr, 4); |
83#ifndef hpux |
|
80 if ((hp = gethostbyaddr(ip, 4, AF_INET))) 81 if (!(ether_hostton(hp->h_name, ether))) 82 goto savearp; | 84 if ((hp = gethostbyaddr(ip, 4, AF_INET))) 85 if (!(ether_hostton(hp->h_name, ether))) 86 goto savearp; |
87#endif |
|
83 84 if (sfd == -1) 85 if ((sfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) 86 { 87 perror("arp: socket"); 88 return -1; 89 } 90tryagain: --- 27 unchanged lines hidden --- | 88 89 if (sfd == -1) 90 if ((sfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) 91 { 92 perror("arp: socket"); 93 return -1; 94 } 95tryagain: --- 27 unchanged lines hidden --- |