tcpbridge_opts.def 9.9 KB

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