4 * ipresend.c (C) 1995-1998 Darren Reed
6 * See the IPFILTER.LICENCE file for details on licencing.
10 static const char sccsid
[] = "%W% %G% (C)1995 Darren Reed";
11 static const char rcsid
[] = "@(#)$Id: ipresend.c,v 2.4 2004/01/08 13:34:31 darrenr Exp $";
13 #include <sys/param.h>
14 #include <sys/types.h>
16 #include <sys/socket.h>
17 #include <netinet/in.h>
18 #include <arpa/inet.h>
19 #include <netinet/in_systm.h>
20 #include <netinet/ip.h>
22 #include <netinet/ip_var.h>
35 extern struct ipread snoop
, pcap
, etherf
, iphex
, tcpd
, iptext
;
39 #ifndef DEFAULT_DEVICE
41 char default_device
[] = "eth0";
44 char default_device
[] = "le0";
47 char default_device
[] = "ln0";
50 char default_device
[] = "ef0";
53 char default_device
[] = "ec0";
55 char default_device
[] = "lan0";
62 char default_device
[] = DEFAULT_DEVICE
;
66 static void usage
__P((char *));
67 int main
__P((int, char **));
70 static void usage(prog
)
73 fprintf(stderr
, "Usage: %s [options] <-r filename|-R filename>\n\
74 \t\t-r filename\tsnoop data file to resend\n\
75 \t\t-R filename\tlibpcap data file to resend\n\
77 \t\t-d device\tSend out on this device\n\
78 \t\t-g gateway\tIP gateway to use if non-local dest.\n\
79 \t\t-m mtu\t\tfake MTU to use when sending out\n\
90 struct ipread
*ipr
= NULL
;
91 char *name
= argv
[0], *gateway
= NULL
, *dev
= NULL
;
95 while ((c
= getopt(argc
, argv
, "EHPRSTXd:g:m:r:")) != -1)
108 fprintf(stderr
, "mtu must be > 28\n");
138 fprintf(stderr
, "Unknown option \"%c\"\n", c
);
146 if (gateway
&& resolve(gateway
, (char *)&gwip
) == -1)
148 fprintf(stderr
,"Cant resolve %s\n", gateway
);
153 dev
= default_device
;
155 printf("Device: %s\n", dev
);
156 printf("Gateway: %s\n", inet_ntoa(gwip
));
157 printf("mtu: %d\n", mtu
);
159 return ip_resend(dev
, mtu
, ipr
, gwip
, resend
);