tcpbridge_opts.def 9.1 KB

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