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";
42 char default_device[] = "ln0";
45 char default_device[] = "ef0";
47 char default_device[] = "lan0";
52 char default_device[] = DEFAULT_DEVICE;
56 static void usage __P((char *));
57 int main __P((int, char **));
60 static void usage(prog)
63 fprintf(stderr, "Usage: %s [options] <-r filename|-R filename>\n\
64 \t\t-r filename\tsnoop data file to resend\n\
65 \t\t-R filename\tlibpcap data file to resend\n\
67 \t\t-d device\tSend out on this device\n\
68 \t\t-g gateway\tIP gateway to use if non-local dest.\n\
69 \t\t-m mtu\t\tfake MTU to use when sending out\n\
80 struct ipread *ipr = NULL;
81 char *name = argv[0], *gateway = NULL, *dev = NULL;
85 while ((c = getopt(argc, argv, "EHPRSTXd:g:m:r:")) != -1)
98 fprintf(stderr, "mtu must be > 28\n");
119 fprintf(stderr, "Unknown option \"%c\"\n", c);
127 if (gateway && resolve(gateway, (char *)&gwip) == -1)
129 fprintf(stderr,"Cant resolve %s\n", gateway);
134 dev = default_device;
136 printf("Device: %s\n", dev);
137 printf("Gateway: %s\n", inet_ntoa(gwip));
138 printf("mtu: %d\n", mtu);
140 return ip_resend(dev, mtu, ipr, gwip, resend);