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$";
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>
21 #include <netinet/ip_var.h>
33 extern struct ipread pcap, iphex, iptext;
37 #ifndef DEFAULT_DEVICE
39 char default_device[] = "le0";
41 char default_device[] = "lan0";
44 char default_device[] = DEFAULT_DEVICE;
48 static void usage __P((char *));
49 int main __P((int, char **));
52 static void usage(prog)
55 fprintf(stderr, "Usage: %s [options] <-r filename|-R filename>\n\
56 \t\t-r filename\tsnoop data file to resend\n\
57 \t\t-R filename\tlibpcap data file to resend\n\
59 \t\t-d device\tSend out on this device\n\
60 \t\t-g gateway\tIP gateway to use if non-local dest.\n\
61 \t\t-m mtu\t\tfake MTU to use when sending out\n\
72 struct ipread *ipr = NULL;
73 char *name = argv[0], *gateway = NULL, *dev = NULL;
77 while ((c = getopt(argc, argv, "EHPRSTXd:g:m:r:")) != -1)
90 fprintf(stderr, "mtu must be > 28\n");
111 fprintf(stderr, "Unknown option \"%c\"\n", c);
119 if (gateway && resolve(gateway, (char *)&gwip) == -1)
121 fprintf(stderr,"Cant resolve %s\n", gateway);
126 dev = default_device;
128 printf("Device: %s\n", dev);
129 printf("Gateway: %s\n", inet_ntoa(gwip));
130 printf("mtu: %d\n", mtu);
132 return ip_resend(dev, mtu, ipr, gwip, resend);