tcpreplay_opts.def 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  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 = "tcpreplay";
  34. #ifdef TCPREPLAY_EDIT_MAN
  35. prog-name = "tcpreplay-edit";
  36. #else
  37. prog-name = "tcpreplay";
  38. #endif
  39. prog-title = "Replay network traffic stored in pcap files";
  40. long-opts;
  41. gnu-usage;
  42. help-value = "H";
  43. save-opts-value = "";
  44. load-opts-value = "";
  45. argument = "<pcap_file(s)>";
  46. config-header = "config.h";
  47. include = "#include \"defines.h\"\n"
  48. "#include \"tcpreplay.h\"\n"
  49. "#include \"common.h\"\n"
  50. "#include \"config.h\"\n"
  51. "#include <stdlib.h>\n"
  52. "#include <sys/types.h>\n"
  53. "#include <unistd.h>\n";
  54. homerc = "$$/";
  55. #ifdef TCPREPLAY_EDIT
  56. #include tcpedit/tcpedit_opts.def
  57. #endif
  58. explain = <<- EOExplain
  59. tcpreplay is a tool for replaying network traffic from files saved with
  60. tcpdump or other tools which write pcap(3) files.
  61. EOExplain;
  62. detail = <<- EODetail
  63. The basic operation of tcpreplay is to resend all packets from the
  64. input file(s) at the speed at which they were recorded, or a specified
  65. data rate, up to as fast as the hardware is capable.
  66. Optionally, the traffic can be split between two interfaces, written to
  67. files, filtered and edited in various ways, providing the means to test
  68. firewalls, NIDS and other network devices.
  69. For more details, please see the Tcpreplay Manual at:
  70. http://tcpreplay.appneta.com
  71. EODetail;
  72. man-doc = <<- EOMan
  73. .SH "SIGNALS"
  74. tcpreplay understands the following signals:
  75. @enumerate
  76. @item @var{SIGUSR1}
  77. Suspend tcpreplay
  78. @item @var{SIGCONT}
  79. Restart tcpreplay
  80. @end enumerate
  81. .SH "SEE ALSO"
  82. tcpdump(1), tcpbridge(1), tcprewrite(1), tcpprep(1), tcpcapinfo(1)
  83. .SH "BUGS"
  84. tcpreplay can only send packets as fast as your computer's interface,
  85. processor, disk and system bus will allow.
  86. Packet timing at high speeds is a black art and very OS/CPU dependent.
  87. Replaying captured traffic may simulate odd or broken conditions on your
  88. network and cause all sorts of problems.
  89. In most cases, you can not replay traffic back to/at a server.
  90. Some operating systems by default do not allow for forging source MAC
  91. addresses. Please consult your operating system's documentation and the
  92. tcpreplay FAQ if you experience this issue.
  93. EOMan;
  94. flag = {
  95. ifdef = DEBUG;
  96. name = dbug;
  97. value = d;
  98. arg-type = number;
  99. max = 1;
  100. immediate;
  101. arg-range = "0->5";
  102. arg-default = 0;
  103. descrip = "Enable debugging output";
  104. doc = <<- EOText
  105. If configured with --enable-debug, then you can specify a verbosity
  106. level for debugging output. Higher numbers increase verbosity.
  107. EOText;
  108. };
  109. flag = {
  110. name = quiet;
  111. value = q;
  112. descrip = "Quiet mode";
  113. doc = "Print nothing except the statistics at the end of the run";
  114. };
  115. flag = {
  116. name = timer;
  117. value = T;
  118. arg-default = "gtod";
  119. max = 1;
  120. arg-type = string;
  121. descrip = "Select packet timing mode: select, ioport, gtod, nano";
  122. doc = <<- EOText
  123. Allows you to select the packet timing method to use:
  124. @enumerate
  125. @item nano
  126. - Use nanosleep() API
  127. @item select
  128. - Use select() API
  129. @item ioport
  130. - Write to the i386 IO Port 0x80
  131. @item gtod [default]
  132. - Use a gettimeofday() loop
  133. @end enumerate
  134. EOText;
  135. };
  136. flag = {
  137. name = maxsleep;
  138. arg-type = number;
  139. arg-default = 0;
  140. descrip = "Sleep for no more then X milliseconds between packets";
  141. doc = <<- EOText
  142. Set a limit for the maximum number of milliseconds that tcpreplay will sleep
  143. between packets. Effectively prevents long delays between packets without
  144. effecting the majority of packets. Default is disabled.
  145. EOText;
  146. };
  147. /* Verbose decoding via tcpdump */
  148. flag = {
  149. ifdef = ENABLE_VERBOSE;
  150. name = verbose;
  151. value = v;
  152. max = 1;
  153. immediate;
  154. descrip = "Print decoded packets via tcpdump to STDOUT";
  155. settable;
  156. doc = "";
  157. };
  158. flag = {
  159. ifdef = ENABLE_VERBOSE;
  160. name = decode;
  161. flags-must = verbose;
  162. value = A;
  163. arg-type = string;
  164. max = 1;
  165. descrip = "Arguments passed to tcpdump decoder";
  166. doc = <<- EOText
  167. When enabling verbose mode (@var{-v}) you may also specify one or more
  168. additional arguments to pass to @code{tcpdump} to modify the way packets
  169. are decoded. By default, -n and -l are used. Be sure to
  170. quote the arguments like: -A "-axxx" so that they are not interpreted
  171. by tcpreplay. Please see the tcpdump(1) man page for a complete list of
  172. options.
  173. EOText;
  174. };
  175. flag = {
  176. name = preload_pcap;
  177. value = K;
  178. descrip = "Preloads packets into RAM before sending";
  179. doc = <<- EOText
  180. This option loads the specified pcap(s) into RAM before starting to send in order
  181. to improve replay performance while introducing a startup performance hit.
  182. Preloading can be used with or without @var{--loop}. This option also suppresses
  183. flow statistics collection for every iteration, which can significantly reduce
  184. memory usage. Flow statistics are predicted based on options supplied and
  185. statistics collected from the first loop iteration.
  186. EOText;
  187. };
  188. /*
  189. * Output modifiers: -c
  190. */
  191. flag = {
  192. name = cachefile;
  193. value = c;
  194. arg-type = string;
  195. flags-cant = dualfile;
  196. flags-must = intf2;
  197. max = 1;
  198. descrip = "Split traffic via a tcpprep cache file";
  199. doc = <<- EOText
  200. If you have a pcap file you would like to use to send bi-directional
  201. traffic through a device (firewall, router, IDS, etc) then using tcpprep
  202. you can create a cachefile which tcpreplay will use to split the traffic
  203. across two network interfaces.
  204. EOText;
  205. };
  206. flag = {
  207. name = dualfile;
  208. value = 2;
  209. max = 1;
  210. flags-cant = cachefile;
  211. flags-must = intf2;
  212. descrip = "Replay two files at a time from a network tap";
  213. doc = <<- EOText
  214. If you captured network traffic using a network tap, then you can end up with
  215. two pcap files- one for each direction. This option will replay these two
  216. files at the same time, one on each interface and inter-mix them using the
  217. timestamps in each.
  218. EOText;
  219. };
  220. /*
  221. * Outputs: -i, -I
  222. */
  223. flag = {
  224. name = intf1;
  225. value = i;
  226. arg-type = string;
  227. max = 1;
  228. must-set;
  229. descrip = "Client to server/RX/primary traffic output interface";
  230. doc = <<- EOText
  231. Required network interface used to send either all traffic or traffic which is
  232. marked as 'primary' via tcpprep. Primary traffic is usually client-to-server
  233. or inbound (RX) on khial virtual interfaces.
  234. EOText;
  235. };
  236. flag = {
  237. name = intf2;
  238. value = I;
  239. arg-type = string;
  240. max = 1;
  241. descrip = "Server to client/TX/secondary traffic output interface";
  242. doc = <<- EOText
  243. Optional network interface used to send traffic which is marked as 'secondary'
  244. via tcpprep. Secondary traffic is usually server-to-client or outbound
  245. (TX) on khial virtual interfaces. Generally, it only makes sense to use this
  246. option with --cachefile.
  247. EOText;
  248. };
  249. flag = {
  250. ifdef = ENABLE_PCAP_FINDALLDEVS;
  251. name = listnics;
  252. descrip = "List available network interfaces and exit";
  253. immediate;
  254. doc = "";
  255. flag-code = <<- EOFlag
  256. interface_list_t *list = get_interface_list();
  257. list_interfaces(list);
  258. free(list);
  259. exit(0);
  260. EOFlag;
  261. };
  262. /*
  263. * Limits and loops: -l
  264. */
  265. flag = {
  266. name = loop;
  267. value = l;
  268. arg-type = number;
  269. arg-range = "0->";
  270. max = 1;
  271. descrip = "Loop through the capture file X times";
  272. arg-default = 1;
  273. doc = "";
  274. };
  275. flag = {
  276. name = loopdelay-ms;
  277. flags-must = loop;
  278. arg-type = number;
  279. arg-range = "0->";
  280. descrip = "Delay between loops in milliseconds";
  281. arg-default = 0;
  282. doc = "";
  283. };
  284. flag = {
  285. name = pktlen;
  286. max = 1;
  287. descrip = "Override the snaplen and use the actual packet len";
  288. doc = <<- EOText
  289. By default, tcpreplay will send packets based on the size of the "snaplen"
  290. stored in the pcap file which is usually the correct thing to do. However,
  291. occasionally, tools will store more bytes then told to. By specifying this
  292. option, tcpreplay will ignore the snaplen field and instead try to send
  293. packets based on the original packet length. Bad things may happen if
  294. you specify this option.
  295. EOText;
  296. };
  297. flag = {
  298. name = limit;
  299. value = L;
  300. arg-type = number;
  301. max = 1;
  302. arg-default = -1;
  303. arg-range = "1->";
  304. descrip = "Limit the number of packets to send";
  305. doc = <<- EOText
  306. By default, tcpreplay will send all the packets. Alternatively, you can
  307. specify a maximum number of packets to send.
  308. EOText;
  309. };
  310. flag = {
  311. name = duration;
  312. arg-type = number;
  313. max = 1;
  314. arg-default = -1;
  315. arg-range = "1->";
  316. descrip = "Limit the number of seconds to send";
  317. doc = <<- EOText
  318. By default, tcpreplay will send all the packets. Alternatively, you can
  319. specify a maximum number of seconds to transmit.
  320. EOText;
  321. };
  322. /*
  323. * Replay speed modifiers: -m, -p, -r, -R, -o
  324. */
  325. /* note that this is really a float, but autoopts does not support float */
  326. flag = {
  327. name = multiplier;
  328. flags-cant = pps;
  329. flags-cant = mbps;
  330. flags-cant = oneatatime;
  331. flags-cant = topspeed;
  332. value = x;
  333. arg-type = string;
  334. max = 1;
  335. descrip = "Modify replay speed to a given multiple";
  336. doc = <<- EOText
  337. Specify a value to modify the packet replay speed.
  338. Examples:
  339. @example
  340. 2.0 will replay traffic at twice the speed captured
  341. 0.7 will replay traffic at 70% the speed captured
  342. @end example
  343. EOText;
  344. };
  345. flag = {
  346. name = pps;
  347. flags-cant = multiplier;
  348. flags-cant = mbps;
  349. flags-cant = oneatatime;
  350. flags-cant = topspeed;
  351. value = p;
  352. arg-type = string;
  353. max = 1;
  354. descrip = "Replay packets at a given packets/sec";
  355. doc = <<- EOText
  356. Specify a value to regulate the packet replay to a specific packet-per-second rate.
  357. Examples:
  358. @example
  359. 200 will replay traffic at 200 packets per second
  360. 0.25 will replay traffic at 15 packets per minute
  361. @end example
  362. EOText;
  363. };
  364. flag = {
  365. name = mbps;
  366. flags-cant = multiplier;
  367. flags-cant = pps;
  368. flags-cant = oneatatime;
  369. flags-cant = topspeed;
  370. value = M;
  371. arg-type = string;
  372. max = 1;
  373. descrip = "Replay packets at a given Mbps";
  374. doc = <<- EOText
  375. Specify a floating point value for the Mbps rate that tcpreplay
  376. should send packets at.
  377. EOText;
  378. };
  379. flag = {
  380. name = topspeed;
  381. flags-cant = mbps;
  382. flags-cant = multiplier;
  383. flags-cant = pps;
  384. flags-cant = oneatatime;
  385. value = t;
  386. descrip = "Replay packets as fast as possible";
  387. doc = "";
  388. };
  389. flag = {
  390. name = oneatatime;
  391. flags-cant = mbps;
  392. flags-cant = pps;
  393. flags-cant = multiplier;
  394. flags-cant = topspeed;
  395. value = o;
  396. descrip = "Replay one packet at a time for each user input";
  397. doc = <<- EOText
  398. Allows you to step through one or more packets at a time.
  399. EOText;
  400. };
  401. flag = {
  402. name = pps-multi;
  403. arg-type = number;
  404. flags-must = pps;
  405. arg-default = 1;
  406. arg-range = "1->";
  407. descrip = "Number of packets to send for each time interval";
  408. doc = <<- EOText
  409. When trying to send packets at very high rates, the time between each packet
  410. can be so short that it is impossible to accurately sleep for the required
  411. period of time. This option allows you to send multiple packets at a time,
  412. thus allowing for longer sleep times which can be more accurately implemented.
  413. EOText;
  414. };
  415. flag = {
  416. name = unique-ip;
  417. flags-must = loop;
  418. #ifdef TCPREPLAY_EDIT
  419. flags-cant = seed;
  420. flags-cant = fuzz-seed;
  421. #endif
  422. descrip = "Modify IP addresses each loop iteration to generate unique flows";
  423. doc = <<- EOText
  424. Ensure IPv4 and IPv6 packets will be unique for each @var{--loop} iteration.
  425. This is done in a way that will not alter packet CRC, and therefore will genrally
  426. not affect performance. This option will significantly increase the flows/sec over
  427. generated over multiple loop iterations.
  428. EOText;
  429. };
  430. flag = {
  431. name = unique-ip-loops;
  432. flags-must = unique-ip;
  433. arg-type = string;
  434. max = 1;
  435. descrip = "Number of times to loop before assigning new unique ip";
  436. doc = <<- EOText
  437. Number of @var{--loop} iterations before a new unique IP is assigned. Default
  438. is 1. Assumes both @var{--loop} and @var{--unique-ip}.
  439. EOText;
  440. };
  441. flag = {
  442. ifdef = HAVE_NETMAP;
  443. name = netmap;
  444. descrip = "Write packets directly to netmap enabled network adapter";
  445. doc = <<- EOText
  446. This feature will detect netmap capable network drivers on Linux and BSD
  447. systems. If detected, the network driver is bypassed for the execution
  448. duration, and network buffers will be written to directly. This will allow
  449. you to achieve full line rates on commodity network adapters, similar to rates
  450. achieved by commercial network traffic generators. Note that bypassing the network
  451. driver will disrupt other applications connected through the test interface. See
  452. INSTALL for more information.
  453. This feature can also be enabled by specifying an interface as 'netmap:<intf>'
  454. or 'vale:<intf>. For example 'netmap:eth0' specifies netmap over interface eth0.
  455. EOText;
  456. };
  457. flag = {
  458. ifdef = HAVE_NETMAP;
  459. name = nm-delay;
  460. arg-type = number;
  461. arg-default = 10;
  462. descrip = "Netmap startup delay";
  463. doc = <<- EOText
  464. Number of seconds to delay after netmap is loaded. Required to ensure interfaces
  465. are fully up before netmap transmit. Requires netmap option. Default is 10 seconds.
  466. EOText;
  467. };
  468. flag = {
  469. name = no-flow-stats;
  470. descrip = "Suppress printing and tracking flow count, rates and expirations";
  471. doc = <<- EOText
  472. Suppress the collection and printing of flow statistics. This option may
  473. improve performance when not using @var{--preload-pcap} option, otherwise
  474. its only function is to suppress printing.
  475. The flow feature will track and print statistics of the flows being sent.
  476. A flow is loosely defined as a unique combination of a 5-tuple, i.e.
  477. source IP, destination IP, source port, destination port and protocol.
  478. If @var{--loop} is specified, the flows from one iteration to the next
  479. will not be unique, unless the packets are altered. Use @var{--unique-ip}
  480. or @var{tcpreplay-edit} to alter packets between iterations.
  481. EOText;
  482. };
  483. flag = {
  484. name = flow-expiry;
  485. arg-type = number;
  486. flags-cant = no-flow-stats;
  487. arg-default = 0;
  488. arg-range = "0->";
  489. descrip = "Number of inactive seconds before a flow is considered expired";
  490. doc = <<- EOText
  491. This option will track and report flow expirations based on the flow idle
  492. times. The timestamps within the pcap file are used to determine the expiry,
  493. not the actual timestamp of the packets are replayed. For example, a value of
  494. 30 suggests that if no traffic is seen on a flow for 30 seconds, any
  495. subsequent traffic would be considered a new flow, and thereby will increment
  496. the flows and flows per second (fps) statistics.
  497. This option can be used to optimize flow timeout settings for flow products.
  498. Setting the timeout low may lead to flows being dropped when in fact the flow
  499. is simply slow to respond. Configuring your flow timeouts too high may
  500. increase resources required by your flow product.
  501. Note that using this option while replaying at higher than original speeds
  502. can lead to inflated flows and fps counts.
  503. Default is 0 (no expiry) and a typical value is 30-120 seconds.
  504. EOText;
  505. };
  506. flag = {
  507. name = pid;
  508. value = P;
  509. descrip = "Print the PID of tcpreplay at startup";
  510. flag-code = <<- EOPid
  511. fprintf(stderr, "PID: %d\n", getpid());
  512. EOPid;
  513. doc = "";
  514. };
  515. flag = {
  516. name = stats;
  517. arg-type = number;
  518. arg-range = "0->";
  519. descrip = "Print statistics every X seconds, or every loop if '0'";
  520. doc = <<- EOText
  521. Note that timed delays are a "best effort" and long delays between
  522. sending packets may cause equally long delays between printing statistics.
  523. EOText;
  524. };
  525. flag = {
  526. name = version;
  527. value = V;
  528. descrip = "Print version information";
  529. flag-code = <<- EOVersion
  530. fprintf(stderr, "tcpreplay version: %s (build %s)", VERSION, git_version());
  531. #ifdef DEBUG
  532. fprintf(stderr, " (debug)");
  533. #endif
  534. #ifdef TIMESTAMP_TRACE
  535. fprintf(stderr, " (timestamp-trace)");
  536. #endif
  537. fprintf(stderr, "\n");
  538. fprintf(stderr, "Copyright 2013-2018 by Fred Klassen <tcpreplay at appneta dot com> - AppNeta\n");
  539. fprintf(stderr, "Copyright 2000-2012 by Aaron Turner <aturner at synfin dot net>\n");
  540. fprintf(stderr, "The entire Tcpreplay Suite is licensed under the GPLv3\n");
  541. fprintf(stderr, "Cache file supported: %s\n", CACHEVERSION);
  542. #ifdef HAVE_LIBDNET
  543. fprintf(stderr, "Compiled against libdnet: %s\n", LIBDNET_VERSION);
  544. #else
  545. fprintf(stderr, "Not compiled with libdnet.\n");
  546. #endif
  547. #ifdef HAVE_WINPCAP
  548. fprintf(stderr, "Compiled against winpcap: %s\n", get_pcap_version());
  549. #elif defined HAVE_PF_RING_PCAP
  550. fprintf(stderr, "Compiled against PF_RING libpcap: %s\n", get_pcap_version());
  551. #else
  552. fprintf(stderr, "Compiled against libpcap: %s\n", get_pcap_version());
  553. #endif
  554. #ifdef ENABLE_64BITS
  555. fprintf(stderr, "64 bit packet counters: enabled\n");
  556. #else
  557. fprintf(stderr, "64 bit packet counters: disabled\n");
  558. #endif
  559. #ifdef ENABLE_VERBOSE
  560. fprintf(stderr, "Verbose printing via tcpdump: enabled\n");
  561. #else
  562. fprintf(stderr, "Verbose printing via tcpdump: disabled\n");
  563. #endif
  564. #ifdef TCPREPLAY_EDIT
  565. fprintf(stderr, "Packet editing: enabled\n");
  566. #else
  567. fprintf(stderr, "Packet editing: disabled\n");
  568. #endif
  569. #ifdef ENABLE_FRAGROUTE
  570. fprintf(stderr, "Fragroute engine: enabled\n");
  571. #else
  572. fprintf(stderr, "Fragroute engine: disabled\n");
  573. #endif
  574. #if defined HAVE_NETMAP
  575. fprintf(stderr, "Default injection method: %s\n", sendpacket_get_method(NULL));
  576. #else
  577. fprintf(stderr, "Injection method: %s\n", sendpacket_get_method(NULL));
  578. #endif
  579. #ifdef HAVE_NETMAP
  580. fprintf(stderr, "Optional injection method: netmap\n");
  581. #else
  582. fprintf(stderr, "Not compiled with netmap\n");
  583. #endif
  584. exit(0);
  585. EOVersion;
  586. doc = "";
  587. };
  588. flag = {
  589. name = less-help;
  590. value = "h";
  591. immediate;
  592. descrip = "Display less usage information and exit";
  593. flag-code = <<- EOHelp
  594. USAGE(EXIT_FAILURE);
  595. EOHelp;
  596. doc = "";
  597. };