tcpbridge_opts.def 8.4 KB

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