tcpbridge_opts.def 11 KB

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