tcpbridge_opts.def 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. autogen definitions options;
  2. copyright = {
  3. date = "2005-2007";
  4. owner = "Aaron Turner";
  5. type = "bsd";
  6. author = <<- EOText
  7. Copyright 2000-2007 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. /*
  115. * Select which packets to process
  116. */
  117. flag = {
  118. name = limit;
  119. value = L;
  120. arg-type = number;
  121. max = 1;
  122. arg-default = -1;
  123. arg-range = "1->";
  124. descrip = "Limit the number of packets to send";
  125. doc = <<- EOText
  126. By default, tcpbridge will send packets forever or until Ctrl-C. Alternatively,
  127. you can specify a maximum number of packets to send.
  128. EOText;
  129. };
  130. /* Include/Exclude */
  131. flag = {
  132. name = include;
  133. value = x;
  134. arg-type = string;
  135. max = 1;
  136. descrip = "Include only packets matching rule";
  137. flags-cant = exclude;
  138. flag-code = <<- EOInclude
  139. char *include;
  140. include = safe_strdup(OPT_ARG(INCLUDE));
  141. options.xX.mode = xX_MODE_INCLUDE;
  142. if ((options.xX.mode = parse_xX_str(&options.xX, include, &options.bpf)) == xXError)
  143. errx(1, "Unable to parse include/exclude rule: %s", OPT_ARG(INCLUDE));
  144. free(include);
  145. EOInclude;
  146. doc = <<- EOText
  147. Override default of sending all packets stored in the capture file and only
  148. send packets which match the provided rule. Rules can be one of:
  149. @table @bullet
  150. @item S:<CIDR1>,...
  151. - Source IP must match specified CIDR(s)
  152. @item D:<CIDR1>,...
  153. - Destination IP must match specified CIDR(s)
  154. @item B:<CIDR1>,...
  155. - Both source and destination IP must match specified CIDR(s)
  156. @item E:<CIDR1>,...
  157. - Either IP must match specified CIDR(s)
  158. @item P:<LIST>
  159. - Must be one of the listed packets where the list
  160. corresponds to the packet number in the capture file.
  161. @example
  162. --include=P:1-5,9,15,72-
  163. @end example
  164. would send packets 1 thru 5, the 9th and 15th packet, and packets 72 until the
  165. end of the file
  166. @item F:'<bpf>'
  167. - BPF filter. See the @file{tcpdump(8)} man page for syntax.
  168. @end table
  169. EOText;
  170. };
  171. flag = {
  172. name = exclude;
  173. value = X;
  174. arg-type = string;
  175. max = 1;
  176. descrip = "Exclude any packet matching this rule";
  177. flags-cant = include;
  178. flag-code = <<- EOExclude
  179. char *exclude;
  180. exclude = safe_strdup(OPT_ARG(EXCLUDE));
  181. options.xX.mode = xX_MODE_EXCLUDE;
  182. if ((options.xX.mode = parse_xX_str(&options.xX, exclude, &options.bpf)) == xXError)
  183. errx(1, "Unable to parse include/exclude rule: %s", OPT_ARG(EXCLUDE));
  184. free(exclude);
  185. EOExclude;
  186. doc = <<- EOText
  187. Override default of sending all packets stored in the capture file and only
  188. send packets which do not match the provided rule. Rules can be one of:
  189. @table @bullet
  190. @item S:<CIDR1>,...
  191. - Source IP must not match specified CIDR(s)
  192. @item D:<CIDR1>,...
  193. - Destination IP must not match specified CIDR(s)
  194. @item B:<CIDR1>,...
  195. - Both source and destination IP must not match specified CIDR(s)
  196. @item E:<CIDR1>,...
  197. - Either IP must not match specified CIDR(s)
  198. @item P:<LIST>
  199. - Must not be one of the listed packets where the list
  200. corresponds to the packet number in the capture file.
  201. @example
  202. --exclude=P:1-5,9,15,72-
  203. @end example
  204. would drop packets 1 thru 5, the 9th and 15th packet, and packets 72 until the
  205. end of the file
  206. @end table
  207. EOText;
  208. };
  209. flag = {
  210. name = pid;
  211. value = P;
  212. descrip = "Print the PID of tcpbridge at startup";
  213. flag-code = <<- EOPid
  214. fprintf(stderr, "PID: %hu\n", getpid());
  215. EOPid;
  216. doc = "";
  217. };
  218. /* Verbose decoding via tcpdump */
  219. flag = {
  220. ifdef = ENABLE_VERBOSE;
  221. name = verbose;
  222. value = v;
  223. max = 1;
  224. immediate;
  225. descrip = "Print decoded packets via tcpdump to STDOUT";
  226. settable;
  227. doc = "";
  228. };
  229. flag = {
  230. ifdef = ENABLE_VERBOSE;
  231. name = decode;
  232. flags-must = verbose;
  233. value = A;
  234. arg-type = string;
  235. max = 1;
  236. descrip = "Arguments passed to tcpdump decoder";
  237. doc = <<- EOText
  238. When enabling verbose mode (@var{-v}) you may also specify one or more
  239. additional arguments to pass to @code{tcpdump} to modify the way packets
  240. are decoded. By default, -n and -l are used. Be sure to
  241. quote the arguments like: --verbose="-axxx" so that they are not interpreted
  242. by tcpbridge. The following arguments are vaild:
  243. [ -aAeNqRStuvxX ]
  244. [ -E spi@ipaddr algo:secret,... ]
  245. [ -s snaplen ]
  246. EOText;
  247. };
  248. flag = {
  249. name = version;
  250. value = V;
  251. descrip = "Print version information";
  252. flag-code = <<- EOVersion
  253. fprintf(stderr, "tcpbridge version: %s (build %s)", VERSION, svn_version());
  254. #ifdef DEBUG
  255. fprintf(stderr, " (debug)");
  256. #endif
  257. fprintf(stderr, "\n");
  258. fprintf(stderr, "Copyright 2001-2007 by Aaron Turner <aturner at synfin dot net>\n");
  259. #ifdef HAVE_LIBNET
  260. fprintf(stderr, "Compiled against libnet: %s\n", LIBNET_VERSION);
  261. #else
  262. fprintf(stderr, "Not compiled with libnet.\n");
  263. #endif
  264. #ifdef HAVE_WINPCAP
  265. fprintf(stderr, "Compiled against winpcap: %s\n", get_pcap_version());
  266. #else
  267. fprintf(stderr, "Compiled against libpcap: %s\n", get_pcap_version());
  268. #endif
  269. #ifdef ENABLE_64BITS
  270. fprintf(stderr, "64 bit packet counters: enabled\n");
  271. #else
  272. fprintf(stderr, "64 bit packet counters: disabled\n");
  273. #endif
  274. #ifdef ENABLE_VERBOSE
  275. fprintf(stderr, "Verbose printing via tcpdump: enabled\n");
  276. #else
  277. fprintf(stderr, "Verbose printing via tcpdump: disabled\n");
  278. #endif
  279. exit(0);
  280. EOVersion;
  281. doc = "";
  282. };
  283. flag = {
  284. name = less-help;
  285. value = "h";
  286. immediate;
  287. descrip = "Display less usage information and exit";
  288. flag-code = <<- EOHelp
  289. USAGE(EXIT_FAILURE);
  290. EOHelp;
  291. doc = "";
  292. };