tcpreplay_opts.def 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  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 = "tcpreplay";
  14. prog-name = "tcpreplay";
  15. prog-title = "Replay network traffic stored in pcap files";
  16. long-opts;
  17. gnu-usage;
  18. help-value = "H";
  19. save-opts-value = "";
  20. load-opts-value = "";
  21. argument = "<pcap_file(s)>";
  22. config-header = "config.h";
  23. include = "#include \"defines.h\"\n"
  24. "#include \"tcpreplay.h\"\n"
  25. "#include \"common.h\"\n"
  26. "#include \"config.h\"\n"
  27. "#include <stdlib.h>\n"
  28. "#include <sys/types.h>\n"
  29. "#include <unistd.h>\n"
  30. "extern tcpreplay_opt_t options;\n";
  31. homerc = "$$/";
  32. #ifdef TCPREPLAY_EDIT
  33. #include tcpedit/tcpedit_opts.def
  34. #endif
  35. explain = <<- EOExplain
  36. tcpreplay is a tool for replaying network traffic from files saved with
  37. tcpdump or other tools which write pcap(3) files.
  38. EOExplain;
  39. detail = <<- EODetail
  40. The basic operation of tcpreplay is to resend all packets from the
  41. input file(s) at the speed at which they were recorded, or a specified
  42. data rate, up to as fast as the hardware is capable.
  43. Optionally, the traffic can be split between two interfaces, written to
  44. files, filtered and edited in various ways, providing the means to test
  45. firewalls, NIDS and other network devices.
  46. For more details, please see the Tcpreplay Manual at:
  47. http://tcpreplay.synfin.net/trac/wiki/manual
  48. EODetail;
  49. man-doc = <<- EOMan
  50. .SH "SIGNALS"
  51. tcpreplay understands the following signals:
  52. @enumerate
  53. @item @var{SIGUSR1}
  54. Suspend tcpreplay
  55. @item @var{SIGCONT}
  56. Restart tcpreplay
  57. @end enumerate
  58. .SH "SEE ALSO"
  59. tcpreplay-edit(1), tcpdump(1), tcpprep(1), tcprewrite(1), libnet(3)
  60. .SH "BUGS"
  61. tcpreplay can only send packets as fast as your computer's interface,
  62. processor, disk and system bus will allow.
  63. Packet timing at high speeds is a black art and very OS/CPU dependent.
  64. Replaying captured traffic may simulate odd or broken conditions on your
  65. network and cause all sorts of problems.
  66. In most cases, you can not replay traffic back to/at a server.
  67. Some operating systems by default do not allow for forging source MAC
  68. addresses. Please consult your operating system's documentation and the
  69. tcpreplay FAQ if you experience this issue.
  70. EOMan;
  71. flag = {
  72. ifdef = DEBUG;
  73. name = dbug;
  74. value = d;
  75. arg-type = number;
  76. max = 1;
  77. immediate;
  78. arg-range = "0->5";
  79. arg-default = 0;
  80. descrip = "Enable debugging output";
  81. doc = <<- EOText
  82. If configured with --enable-debug, then you can specify a verbosity
  83. level for debugging output. Higher numbers increase verbosity.
  84. EOText;
  85. };
  86. flag = {
  87. name = quiet;
  88. value = q;
  89. descrip = "Quiet mode";
  90. doc = "Print nothing except the statistics at the end of the run";
  91. };
  92. flag = {
  93. name = timer;
  94. value = T;
  95. arg-default = "gtod";
  96. max = 1;
  97. arg-type = string;
  98. descrip = "Select packet timing mode: select, ioport, rdtsc, gtod, nano, abstime";
  99. doc = <<- EOText
  100. Allows you to select the packet timing method to use:
  101. @enumerate
  102. @item nano
  103. - Use nanosleep() API
  104. @item select
  105. - Use select() API
  106. @item ioport
  107. - Write to the i386 IO Port 0x80
  108. @item rdtsc
  109. - Use the x86/x86_64/PPC RDTSC
  110. @item gtod [default]
  111. - Use a gettimeofday() loop
  112. @item abstime
  113. - Use OS X's AbsoluteTime API
  114. @end enumerate
  115. EOText;
  116. };
  117. flag = {
  118. name = sleep-accel;
  119. arg-type = number;
  120. arg-default = 0;
  121. descrip = "Reduce the amount of time to sleep by specified usec";
  122. doc = <<- EOText
  123. Reduce the amount of time we would normally sleep between two packets by the
  124. specified number of usec. This provides a "fuzz factor" to compensate for
  125. running on a non-RTOS and other processes using CPU time. Default is disabled.
  126. EOText;
  127. };
  128. flag = {
  129. name = rdtsc-clicks;
  130. max = 1;
  131. arg-type = number;
  132. arg-default = 0;
  133. descrip = "Specify the RDTSC clicks/usec";
  134. doc = <<- EOText
  135. Override the calculated number of RDTSC clicks/usec which is often the speed of the
  136. CPU in Mhz. Only useful if you specified @var{--timer=rdtsc}
  137. EOText;
  138. };
  139. /* Verbose decoding via tcpdump */
  140. flag = {
  141. ifdef = ENABLE_VERBOSE;
  142. name = verbose;
  143. value = v;
  144. max = 1;
  145. immediate;
  146. descrip = "Print decoded packets via tcpdump to STDOUT";
  147. settable;
  148. doc = "";
  149. };
  150. flag = {
  151. ifdef = ENABLE_VERBOSE;
  152. name = decode;
  153. flags-must = verbose;
  154. value = A;
  155. arg-type = string;
  156. max = 1;
  157. descrip = "Arguments passed to tcpdump decoder";
  158. doc = <<- EOText
  159. When enabling verbose mode (@var{-v}) you may also specify one or more
  160. additional arguments to pass to @code{tcpdump} to modify the way packets
  161. are decoded. By default, -n and -l are used. Be sure to
  162. quote the arguments like: -A "-axxx" so that they are not interpreted
  163. by tcpreplay. Please see the tcpdump(1) man page for a complete list of
  164. options.
  165. EOText;
  166. };
  167. /* Cache files to internal memory */
  168. flag = {
  169. name = enable_file_cache;
  170. value = K;
  171. flags-must = loop;
  172. descrip = "Enable caching of packets to internal memory";
  173. doc = <<- EOText
  174. Cache pcap file(s) the first time they are cached in RAM so that subsequent
  175. loops don't incurr any disk I/O latency in order to increase performance. Make
  176. sure you have enough free RAM to store the entire pcap file(s) in memory or the
  177. system will swap and performance will suffer.
  178. EOText;
  179. };
  180. flag = {
  181. name = preload_pcap;
  182. descrip = "Preloads packets into RAM before sending";
  183. doc = <<- EOText
  184. This option loads the specified pcap(s) into RAM before starting to send in order
  185. to improve replay performance while introducing a startup performance hit.
  186. Preloading can be used with or without @var{--loop} and implies
  187. @var{--enable-file-cache}.
  188. EOText;
  189. };
  190. /*
  191. * Output modifiers: -c
  192. */
  193. flag = {
  194. name = cachefile;
  195. value = c;
  196. arg-type = string;
  197. max = 1;
  198. descrip = "Split traffic via a tcpprep cache file";
  199. doc = "";
  200. };
  201. /*
  202. * Outputs: -i, -I
  203. */
  204. flag = {
  205. name = intf1;
  206. value = i;
  207. arg-type = string;
  208. max = 1;
  209. must-set;
  210. descrip = "Server/primary traffic output interface";
  211. doc = "";
  212. };
  213. flag = {
  214. name = intf2;
  215. value = I;
  216. arg-type = string;
  217. max = 1;
  218. flags-must = cachefile;
  219. descrip = "Client/secondary traffic output interface";
  220. doc = "";
  221. };
  222. flag = {
  223. ifdef = ENABLE_PCAP_FINDALLDEVS;
  224. name = listnics;
  225. descrip = "List available network interfaces and exit";
  226. immediate;
  227. doc = "";
  228. flag-code = <<- EOFlag
  229. interface_list_t *list = get_interface_list();
  230. list_interfaces(list);
  231. free(list);
  232. exit(0);
  233. EOFlag;
  234. };
  235. /*
  236. * Limits and loops: -l
  237. */
  238. flag = {
  239. name = loop;
  240. value = l;
  241. arg-type = number;
  242. arg-range = "0->";
  243. max = 1;
  244. descrip = "Loop through the capture file X times";
  245. arg-default = 1;
  246. doc = "";
  247. };
  248. flag = {
  249. name = pktlen;
  250. max = 1;
  251. descrip = "Override the snaplen and use the actual packet len";
  252. doc = <<- EOText
  253. By default, tcpreplay will send packets based on the size of the "snaplen"
  254. stored in the pcap file which is usually the correct thing to do. However,
  255. occasionally, tools will store more bytes then told to. By specifying this
  256. option, tcpreplay will ignore the snaplen field and instead try to send
  257. packets based on the original packet length. Bad things may happen if
  258. you specify this option.
  259. EOText;
  260. };
  261. flag = {
  262. name = limit;
  263. value = L;
  264. arg-type = number;
  265. max = 1;
  266. arg-default = -1;
  267. arg-range = "1->";
  268. descrip = "Limit the number of packets to send";
  269. doc = <<- EOText
  270. By default, tcpreplay will send all the packets. Alternatively, you can
  271. specify a maximum number of packets to send.
  272. EOText;
  273. };
  274. /*
  275. * Replay speed modifiers: -m, -p, -r, -R, -o
  276. */
  277. /* note that this is really a float, but autoopts does not support float */
  278. flag = {
  279. name = multiplier;
  280. flags-cant = pps;
  281. flags-cant = mbps;
  282. flags-cant = oneatatime;
  283. flags-cant = topspeed;
  284. value = x;
  285. arg-type = string;
  286. max = 1;
  287. descrip = "Modify replay speed to a given multiple";
  288. doc = <<- EOText
  289. Specify a floating point value to modify the packet replay speed.
  290. Examples:
  291. @example
  292. 2.0 will replay traffic at twice the speed captured
  293. 0.7 will replay traffic at 70% the speed captured
  294. @end example
  295. EOText;
  296. };
  297. flag = {
  298. name = pps;
  299. flags-cant = multiplier;
  300. flags-cant = mbps;
  301. flags-cant = oneatatime;
  302. flags-cant = topspeed;
  303. value = p;
  304. arg-type = number;
  305. max = 1;
  306. descrip = "Replay packets at a given packets/sec";
  307. doc = "";
  308. };
  309. flag = {
  310. name = mbps;
  311. flags-cant = multiplier;
  312. flags-cant = pps;
  313. flags-cant = oneatatime;
  314. flags-cant = topspeed;
  315. value = M;
  316. arg-type = string;
  317. max = 1;
  318. descrip = "Replay packets at a given Mbps";
  319. doc = <<- EOText
  320. Specify a floating point value for the Mbps rate that tcpreplay
  321. should send packets at.
  322. EOText;
  323. };
  324. flag = {
  325. name = topspeed;
  326. flags-cant = mbps;
  327. flags-cant = multiplier;
  328. flags-cant = pps;
  329. flags-cant = oneatatime;
  330. value = t;
  331. descrip = "Replay packets as fast as possible";
  332. doc = "";
  333. };
  334. flag = {
  335. name = oneatatime;
  336. flags-cant = mbps;
  337. flags-cant = pps;
  338. flags-cant = multiplier;
  339. flags-cant = topspeed;
  340. value = o;
  341. descrip = "Replay one packet at a time for each user input";
  342. doc = <<- EOText
  343. Allows you to step through one or more packets at a time.
  344. EOText;
  345. };
  346. flag = {
  347. name = pps-multi;
  348. arg-type = number;
  349. flags-must = pps;
  350. arg-default = 1;
  351. arg-range = "1->";
  352. descrip = "Number of packets to send for each time interval";
  353. doc = <<- EOText
  354. When trying to send packets at very high rates, the time between each packet
  355. can be so short that it is impossible to accurately sleep for the required
  356. period of time. This option allows you to send multiple packets at a time,
  357. thus allowing for longer sleep times which can be more accurately implemented.
  358. EOText;
  359. };
  360. flag = {
  361. name = pid;
  362. value = P;
  363. descrip = "Print the PID of tcpreplay at startup";
  364. flag-code = <<- EOPid
  365. fprintf(stderr, "PID: %hu\n", getpid());
  366. EOPid;
  367. doc = "";
  368. };
  369. flag = {
  370. name = stats;
  371. arg-type = number;
  372. arg-range = "1->";
  373. descrip = "Print statistics every X seconds";
  374. doc = <<- EOText
  375. Note that this is very much a "best effort" and long delays between
  376. sending packets may cause equally long delays between printing statistics.
  377. EOText;
  378. };
  379. flag = {
  380. name = version;
  381. value = V;
  382. descrip = "Print version information";
  383. flag-code = <<- EOVersion
  384. fprintf(stderr, "tcpreplay version: %s (build %s)", VERSION, svn_version());
  385. #ifdef DEBUG
  386. fprintf(stderr, " (debug)");
  387. #endif
  388. fprintf(stderr, "\n");
  389. fprintf(stderr, "Copyright 2000-2010 by Aaron Turner <aturner at synfin dot net>\n");
  390. fprintf(stderr, "Cache file supported: %s\n", CACHEVERSION);
  391. #ifdef HAVE_LIBDNET
  392. fprintf(stderr, "Compiled against libdnet: %s\n", LIBDNET_VERSION);
  393. #else
  394. fprintf(stderr, "Not compiled with libdnet.\n");
  395. #endif
  396. #ifdef HAVE_WINPCAP
  397. fprintf(stderr, "Compiled against winpcap: %s\n", get_pcap_version());
  398. #else
  399. fprintf(stderr, "Compiled against libpcap: %s\n", get_pcap_version());
  400. #endif
  401. #ifdef ENABLE_64BITS
  402. fprintf(stderr, "64 bit packet counters: enabled\n");
  403. #else
  404. fprintf(stderr, "64 bit packet counters: disabled\n");
  405. #endif
  406. #ifdef ENABLE_VERBOSE
  407. fprintf(stderr, "Verbose printing via tcpdump: enabled\n");
  408. #else
  409. fprintf(stderr, "Verbose printing via tcpdump: disabled\n");
  410. #endif
  411. #ifdef TCPREPLAY_EDIT
  412. fprintf(stderr, "Packet editing: enabled\n");
  413. #else
  414. fprintf(stderr, "Packet editing: disabled\n");
  415. #endif
  416. #ifdef ENABLE_FRAGROUTE
  417. fprintf(stderr, "Fragroute engine: enabled\n");
  418. #else
  419. fprintf(stderr, "Fragroute engine: disabled\n");
  420. #endif
  421. fprintf(stderr, "Injection method: %s\n", sendpacket_get_method());
  422. exit(0);
  423. EOVersion;
  424. doc = "";
  425. };
  426. flag = {
  427. name = less-help;
  428. value = "h";
  429. immediate;
  430. descrip = "Display less usage information and exit";
  431. flag-code = <<- EOHelp
  432. USAGE(EXIT_FAILURE);
  433. EOHelp;
  434. doc = "";
  435. };