root/trunk/src/tcpbridge_opts.def

Revision 2082, 9.5 KB (checked in by aturner, 8 weeks ago)

work on improving tcpbridge performance & portablility
refs #337, #57

  • Property svn:keywords set to Makefile
Line 
1autogen definitions options;
2
3
4copyright = {
5    date        = "2005-2008";
6    owner       = "Aaron Turner";
7    type        = "bsd";
8    author      = <<- EOText
9Copyright 2000-2008 Aaron Turner
10
11For support please use the tcpreplay-users@lists.sourceforge.net mailing list.
12
13The latest version of this software is always available from:
14http://tcpreplay.synfin.net/
15EOText;
16};
17
18package         = "tcpbridge";
19prog-name       = "tcpbridge";
20prog-title      = "Bridge network traffic across two interfaces";
21long-opts;
22gnu-usage;
23help-value      = "H";
24save-opts-value = "";
25load-opts-value = "";
26config-header   = "config.h";
27
28include         = "#include \"defines.h\"\n"
29                "#include \"tcpbridge.h\"\n"
30                "#include \"common.h\"\n"
31                "#include \"config.h\"\n"
32                                "#include <stdlib.h>\n"
33                                "#include <string.h>\n"
34                                "#include <sys/types.h>\n"
35                                "#include <unistd.h>\n"
36                "extern tcpbridge_opt_t options;\n";
37
38
39#include tcpedit/tcpedit_opts.def
40
41
42homerc          = "$$/";
43
44explain = <<- EOExplain
45tcpbridge is a tool for selectively briding network traffic across two interfaces
46and optionally modifying the packets in betweeen
47EOExplain;
48
49detail = <<- EODetail
50The basic operation of tcpbridge is to be a network bridge between two
51subnets.  All packets received on one interface are sent via the other.
52
53Optionally, packets can be edited in a variety of ways according to your needs.
54
55For more details, please see the Tcpreplay Manual at:
56http://tcpreplay.synfin.net/trac/wiki/manual
57EODetail;
58
59man-doc = <<- EOMan
60.SH "SIGNALS"
61tcpbridge understands the following signals:
62@enumerate
63@item @var{SIGUSR1}
64Suspend tcpbridge
65@item @var{SIGCONT}
66Restart tcpbridge
67@end enumerate
68
69.SH "SEE ALSO"
70tcpdump(1), tcpprep(1), tcprewrite(1), tcpreplay(1)
71
72.SH "BUGS"
73tcpbridge can only send packets as fast as your computer's interface,
74processor and system bus will allow.
75
76Connecting both interfaces to the same subnet may create a broadcast storm and
77take down the network.  Improper use of the packet editing functions may have
78other undefined and possible negative consequences.
79
80Some operating systems by default do not allow for forging source MAC
81addresses.  Please consult your operating system's documentation and the
82tcpreplay FAQ if you experiance this issue.
83EOMan;
84
85/*
86 * Debugging
87 */
88
89flag = {
90    ifdef       = DEBUG;
91    name        = dbug;
92    value       = d;
93    arg-type    = number;
94    max         = 1;
95    immediate;
96    arg-range   = "0->5";
97    arg-default = 0;
98    descrip     = "Enable debugging output";
99    doc         = <<- EOText
100If configured with --enable-debug, then you can specify a verbosity
101level for debugging output.  Higher numbers increase verbosity.
102EOText;
103};
104
105
106/*
107 * Outputs: -i, -I
108 */
109
110flag = {
111    name        = intf1;
112    value       = i;
113    arg-type    = string;
114    max         = 1;
115    must-set;
116    descrip     = "Primary interface (listen in uni-directional mode)";
117    doc         = "";
118};
119
120flag = {
121    name        = intf2;
122    value       = I;
123    arg-type    = string;
124    max         = 1;
125    descrip     = "Secondary interface (send in uni-directional mode)";
126    doc         = "";
127};
128
129flag = {
130        name            = unidir;
131        value           = u;
132        max             = 1;
133        descrip         = "Send and receive in only one direction";
134        doc             = <<- EOText
135Normally, tcpbridge will send and receive traffic in both directions
136(bi-directionally).  However, if you choose this option, traffic will
137be sent uni-directionally.
138EOText;
139};
140
141/*
142 * Select which packets to process
143 */
144
145flag = {
146        name            = limit;
147        value           = L;
148        arg-type        = number;
149        max                     = 1;
150        arg-default     = -1;
151        arg-range       = "1->";
152        descrip         = "Limit the number of packets to send";
153        doc             = <<- EOText
154By default, tcpbridge will send packets forever or until Ctrl-C.  Alternatively,
155you can specify a maximum number of packets to send.
156EOText;
157};
158
159/*
160 * Windows users need to provide the MAC addresses of the interfaces
161 * so we can prevent looping (since winpcap doesn't have an API to query)
162 * the MAC address of the NIC's
163 */
164flag = {
165    name        = mac;
166    value       = M;
167    arg-type    = string;
168    max         = 2;
169    stack-arg;
170    descrip     = "MAC addresses of local NIC's";
171    doc         = <<- EOText
172tcpbridge does not support detecting the MAC addresses of the local network
173interfaces under Windows.  Please specify both MAC addresses of the interfaces
174used in the bridge: -M <intf1 mac> -M <intf2 mac>
175EOText;
176};
177
178
179/* Include/Exclude */
180flag = {
181    name        = include;
182    value       = x;
183    arg-type    = string;
184    max         = 1;
185    descrip     = "Include only packets matching rule";
186    flags-cant  = exclude;
187    flag-code   = <<- EOInclude
188   
189    char *include;
190   
191    include = safe_strdup(OPT_ARG(INCLUDE));
192    options.xX.mode = xX_MODE_INCLUDE;
193       
194    if ((options.xX.mode = parse_xX_str(&options.xX, include, &options.bpf)) == xXError)
195        errx(-1, "Unable to parse include/exclude rule: %s", OPT_ARG(INCLUDE));
196
197    free(include);
198   
199EOInclude;
200    doc         = <<- EOText
201Override default of sending all packets stored in the capture file and only
202send packets which match the provided rule.  Rules can be one of:
203
204@table @bullet
205@item S:<CIDR1>,...
206- Source IP must match specified CIDR(s)
207@item D:<CIDR1>,...
208- Destination IP must match specified CIDR(s)
209@item B:<CIDR1>,...
210- Both source and destination IP must match specified CIDR(s)
211@item E:<CIDR1>,...
212- Either IP must match specified CIDR(s)
213@item P:<LIST>     
214- Must be one of the listed packets where the list
215corresponds to the packet number in the capture file.
216@example
217--include=P:1-5,9,15,72-
218@end example
219would send packets 1 thru 5, the 9th and 15th packet, and packets 72 until the
220end of the file
221@item F:'<bpf>'
222- BPF filter.  See the @file{tcpdump(8)} man page for syntax.
223@end table
224EOText;
225};
226
227flag = {
228    name        = exclude;
229    value       = X;
230    arg-type    = string;
231    max         = 1;
232    descrip     = "Exclude any packet matching this rule";
233    flags-cant  = include;
234    flag-code   = <<- EOExclude
235   
236    char *exclude;
237   
238    exclude = safe_strdup(OPT_ARG(EXCLUDE));
239    options.xX.mode = xX_MODE_EXCLUDE;
240   
241    if ((options.xX.mode = parse_xX_str(&options.xX, exclude, &options.bpf)) == xXError)
242        errx(-1, "Unable to parse include/exclude rule: %s", OPT_ARG(EXCLUDE));
243   
244    free(exclude);
245   
246EOExclude;
247    doc         = <<- EOText
248Override default of sending all packets stored in the capture file and only
249send packets which do not match the provided rule.  Rules can be one of:
250
251@table @bullet
252@item S:<CIDR1>,...
253- Source IP must not match specified CIDR(s)
254@item D:<CIDR1>,...
255- Destination IP must not match specified CIDR(s)
256@item B:<CIDR1>,...
257- Both source and destination IP must not match specified CIDR(s)
258@item E:<CIDR1>,...
259- Either IP must not match specified CIDR(s)
260@item P:<LIST>     
261- Must not be one of the listed packets where the list
262corresponds to the packet number in the capture file.
263@example
264--exclude=P:1-5,9,15,72-
265@end example
266would drop packets 1 thru 5, the 9th and 15th packet, and packets 72 until the
267end of the file
268@end table
269EOText;
270};
271
272flag = {
273    name        = pid;
274    value       = P;
275    descrip     = "Print the PID of tcpbridge at startup";
276    flag-code   = <<- EOPid
277   
278    fprintf(stderr, "PID: %hu\n", getpid());
279   
280EOPid;
281    doc         = "";
282};
283
284/* Verbose decoding via tcpdump */
285
286flag = {
287    ifdef       = ENABLE_VERBOSE;
288    name        = verbose;
289    value       = v;
290    max         = 1;
291    immediate;
292    descrip     = "Print decoded packets via tcpdump to STDOUT";
293    settable;
294    doc         = "";
295};
296
297flag = {
298    ifdef       = ENABLE_VERBOSE;
299    name        = decode;
300    flags-must  = verbose;
301    value       = A;
302    arg-type    = string;
303    max         = 1;
304    descrip     = "Arguments passed to tcpdump decoder";
305    doc         = <<- EOText
306When enabling verbose mode (@var{-v}) you may also specify one or more
307additional  arguments to pass to @code{tcpdump} to modify the way packets
308are decoded.  By default, -n and -l are used.   Be  sure  to
309quote the arguments like: --verbose="-axxx" so that they are not interpreted
310by tcpbridge.  The following arguments are vaild:
311    [ -aAeNqRStuvxX ]
312    [ -E spi@ipaddr algo:secret,... ]
313    [ -s snaplen ]
314EOText;
315};
316
317flag = {
318    name        = version;
319    value       = V;
320    descrip     = "Print version information";
321    flag-code   = <<- EOVersion
322   
323    fprintf(stderr, "tcpbridge version: %s (build %s)", VERSION, svn_version());
324#ifdef DEBUG
325    fprintf(stderr, " (debug)");
326#endif
327    fprintf(stderr, "\n");
328    fprintf(stderr, "Copyright 2001-2008 by Aaron Turner <aturner at synfin dot net>\n");
329#ifdef HAVE_LIBDNET
330    fprintf(stderr, "Compiled against libdnet: %s\n", LIBDNET_VERSION);
331#else
332        fprintf(stderr, "Not compiled with libdnet.\n");
333#endif
334#ifdef HAVE_WINPCAP
335    fprintf(stderr, "Compiled against winpcap: %s\n", get_pcap_version());
336#else
337    fprintf(stderr, "Compiled against libpcap: %s\n", get_pcap_version());
338#endif
339#ifdef ENABLE_64BITS
340    fprintf(stderr, "64 bit packet counters: enabled\n");
341#else
342    fprintf(stderr, "64 bit packet counters: disabled\n");
343#endif
344#ifdef ENABLE_VERBOSE
345    fprintf(stderr, "Verbose printing via tcpdump: enabled\n");
346#else
347    fprintf(stderr, "Verbose printing via tcpdump: disabled\n");
348#endif
349    exit(0);
350   
351EOVersion;
352    doc         = "";
353};
354
355flag = {
356    name        = less-help;
357    value       = "h";
358    immediate;
359    descrip     = "Display less usage information and exit";
360    flag-code   = <<- EOHelp
361 
362    USAGE(EXIT_FAILURE);
363
364EOHelp;
365    doc         = "";
366};
Note: See TracBrowser for help on using the browser.