44arp.c (31183) | 44arp.c (53024) |
---|---|
1/* 2 * Based upon 4.4BSD's /usr/sbin/arp 3 */ 4#include <unistd.h> 5#include <string.h> 6#include <stdlib.h> 7#include <sys/param.h> 8#include <sys/file.h> --- 12 unchanged lines hidden (view full) --- 21#include <stdio.h> 22#include <netinet/in.h> 23#include <netinet/ip_var.h> 24#include <netinet/tcp.h> 25#if __FreeBSD_version >= 300000 26# include <net/if_var.h> 27#endif 28#include "ipsend.h" | 1/* 2 * Based upon 4.4BSD's /usr/sbin/arp 3 */ 4#include <unistd.h> 5#include <string.h> 6#include <stdlib.h> 7#include <sys/param.h> 8#include <sys/file.h> --- 12 unchanged lines hidden (view full) --- 21#include <stdio.h> 22#include <netinet/in.h> 23#include <netinet/ip_var.h> 24#include <netinet/tcp.h> 25#if __FreeBSD_version >= 300000 26# include <net/if_var.h> 27#endif 28#include "ipsend.h" |
29#include "iplang/iplang.h" |
|
29 30 31/* 32 * lookup host and return 33 * its IP address in address 34 * (4 bytes) 35 */ 36int resolve(host, address) --- 23 unchanged lines hidden (view full) --- 60{ 61 int mib[6]; 62 size_t needed; 63 char *lim, *buf, *next; 64 struct rt_msghdr *rtm; 65 struct sockaddr_inarp *sin; 66 struct sockaddr_dl *sdl; 67 | 30 31 32/* 33 * lookup host and return 34 * its IP address in address 35 * (4 bytes) 36 */ 37int resolve(host, address) --- 23 unchanged lines hidden (view full) --- 61{ 62 int mib[6]; 63 size_t needed; 64 char *lim, *buf, *next; 65 struct rt_msghdr *rtm; 66 struct sockaddr_inarp *sin; 67 struct sockaddr_dl *sdl; 68 |
69#ifdef IPSEND 70 if (arp_getipv4(ip, ether) == 0) 71 return 0; 72#endif 73 |
|
68 mib[0] = CTL_NET; 69 mib[1] = PF_ROUTE; 70 mib[2] = 0; 71 mib[3] = AF_INET; 72 mib[4] = NET_RT_FLAGS; 73 mib[5] = RTF_LLINFO; 74 if (sysctl(mib, 6, NULL, &needed, NULL, 0) == -1) 75 { --- 28 unchanged lines hidden --- | 74 mib[0] = CTL_NET; 75 mib[1] = PF_ROUTE; 76 mib[2] = 0; 77 mib[3] = AF_INET; 78 mib[4] = NET_RT_FLAGS; 79 mib[5] = RTF_LLINFO; 80 if (sysctl(mib, 6, NULL, &needed, NULL, 0) == -1) 81 { --- 28 unchanged lines hidden --- |