ip.c (53024) | ip.c (72003) |
---|---|
1/* 2 * ip.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[] = "%W% %G% (C)1995"; | 1/* 2 * ip.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[] = "%W% %G% (C)1995"; |
10static const char rcsid[] = "@(#)$Id: ip.c,v 2.1 1999/08/04 17:31:04 darrenr Exp $"; | 10static const char rcsid[] = "@(#)$Id: ip.c,v 2.1.4.1 2001/01/10 06:21:19 darrenr Exp $"; |
11#endif 12#include <errno.h> 13#include <stdio.h> 14#include <stdlib.h> 15#include <unistd.h> 16#include <string.h> 17#include <sys/types.h> 18#include <netinet/in_systm.h> --- 75 unchanged lines hidden (view full) --- 94 static struct in_addr last_gw; 95 static char last_arp[6] = { 0, 0, 0, 0, 0, 0}; 96 static u_short id = 0; 97 ether_header_t *eh; 98 ip_t ipsv; 99 int err, iplen; 100 101 if (!ipbuf) | 11#endif 12#include <errno.h> 13#include <stdio.h> 14#include <stdlib.h> 15#include <unistd.h> 16#include <string.h> 17#include <sys/types.h> 18#include <netinet/in_systm.h> --- 75 unchanged lines hidden (view full) --- 94 static struct in_addr last_gw; 95 static char last_arp[6] = { 0, 0, 0, 0, 0, 0}; 96 static u_short id = 0; 97 ether_header_t *eh; 98 ip_t ipsv; 99 int err, iplen; 100 101 if (!ipbuf) |
102 { |
|
102 ipbuf = (char *)malloc(65536); | 103 ipbuf = (char *)malloc(65536); |
104 if(!ipbuf) 105 { 106 perror("malloc failed"); 107 return -2; 108 } 109 } 110 |
|
103 eh = (ether_header_t *)ipbuf; 104 105 bzero((char *)A_A eh->ether_shost, sizeof(eh->ether_shost)); 106 if (last_gw.s_addr && (gwip.s_addr == last_gw.s_addr)) 107 bcopy(last_arp, (char *)A_A eh->ether_dhost, 6); 108 else if (arp((char *)&gwip, (char *)A_A eh->ether_dhost) == -1) 109 { 110 perror("arp"); --- 237 unchanged lines hidden --- | 111 eh = (ether_header_t *)ipbuf; 112 113 bzero((char *)A_A eh->ether_shost, sizeof(eh->ether_shost)); 114 if (last_gw.s_addr && (gwip.s_addr == last_gw.s_addr)) 115 bcopy(last_arp, (char *)A_A eh->ether_dhost, 6); 116 else if (arp((char *)&gwip, (char *)A_A eh->ether_dhost) == -1) 117 { 118 perror("arp"); --- 237 unchanged lines hidden --- |