summaryrefslogtreecommitdiff
path: root/trafgen.8
AgeCommit message (Collapse)AuthorFilesLines
2018-12-10Fix manpage warningsKartik Mistry1-4/+3
Signed-off-by: Kartik Mistry <kartik.mistry@gmail.com>
2018-05-17man: reformat all man pagesTobias Klauser1-104/+123
- use .TP for option and example labels - use .BR for references to other manpages, also in description texts - highlight options using .B in description texts - misc. cleanups Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-08-10trafgen: Dump proto headers in *.cfg formatVadim Kochan1-2/+2
Added trafgen_dump.c module which dumps headers from packet in .cfg format. Packet is dumped if -o <file>.cfg was specified, it might be useful to specify *.pcap file as input and convert it into .cfg file to edit proto fields in human readable format. To make it possible several main changes were added: 1) packet id is embedded into struct packet.id, and it is updated on each realloc_packet() 2) Added new struct proto_hdr.get_next_proto callback to make possible apply fields of next header. 3) Added new dev_io ops for writting packets into .cfg file, to re-use common dev_io mechsnism for packets dumping. Before dump the default ETH_PROTO fields are applied as first header and then next proto_hdr is identified via .get_next_proto(...) callback. Meanwhile only eth, arp, vlan, ip4, udp, & tcp protos can be dissected into *.cfg format. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-07-17trafgen: Delegate creation of rfraw to dev_io APIVadim Kochan1-1/+2
Simplify a bit of creation rfraw device by delegating it to the dev_io API, also in case the output device is pcap file the --rfraw option sets the link type to ieee80211 radio tap. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-06-09trafgen: Allow to generate packets to output pcap fileVadim Kochan1-2/+3
Add trafgen_dev.c module which provides generic way of reading and writing packets to/from networking device or a pcap file. Also allow to handle output pcap file via '-o, --out, --dev' option. It might be useful in future for testing some link protocols which is not easy to capture (e.g. wlan packets) w/o having some special setup. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> [tklauser: fix whitespace issues] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-02-09trafgen: man: Add description with pcap file for -i, --in optionVadim Kochan1-1/+4
Update -i, --in option with pcap file as input parameter. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-01-05man: trafgen: Add short description about field offset usageVadim Kochan1-0/+44
Add short note about field offset syntax with an example. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-10-04trafgen: man: Highlight packet functions sectionVadim Kochan1-6/+8
Make the each packet functions section name to be bold. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-10-04trafgen: man: Add description for 'pfc()' functionVadim Kochan1-0/+27
Add explanation for 'pfc()' function parameters. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-10-04trafgen: man: Add description for 'pause()' proto functionVadim Kochan1-0/+22
Add explanation for PAUSE(802.3X) header fields. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-23man: trafgen: Fix link to Jesper's exampleVadim Kochan1-1/+1
The link: http://thread.gmane.org/gmane.linux.network/257155 does not work anymore, so replace it with another one at: https://marc.info/?l=linux-netdev&m=135903630614184 Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Suggested-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-21trafgen: man: Simplify example of Jasper's UDP packet by proto functionsVadim Kochan1-3/+3
Removed unneeded fields which are calcuated by default: <udp.len> <ipv4.len> <ipv4.proto> Fixed <ipv4.id> field by changing drnd(2) -> drnd() as proto field <drnd> function does not support bytes length value but randomizes specified field by its length. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-21trafgen: man: Add description for 'dinc' and 'drnd' field functionsVadim Kochan1-0/+43
Add explanation about 'drnd' and 'dinc' functions which might be used for proto field functions. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-07-13trafgen: proto: Add ICMPv4 header generationVadim Kochan1-0/+40
Support for generating ICMPv4 headers using the 'icmp4()/icmpv4()' trafgen generation functions. Fields supported: type Set type field (default 0: Echo reply) Supported keywords: echorequest, echoreply code Set code field (default 0) csum Set checksum field (calculated by default) mtu Set mtu field for destination unreachable (default 0) seq Set sequence field (default 0) id Set identifier field (default 0) addr Set redirect address (default 0.0.0.0) Example (send ping request): { icmpv4(echorequest, seq=1, id=1326) } Signed-off-by: Vadim Kochan <vadim4j@gmail.com> [tk: squash commits, consistency between functionality and docu] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-07-11trafgen: parser: Replace 'mtype' by 'type'Vadim Kochan1-2/+2
After splitting etype & type to different tokens it is possible to use 'type' for ICMP type field which is used by RFC. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-25trafgen: proto: Add ICMPv6 header generationTobias Klauser1-0/+25
Support for generating simple ICMPv6 headers using the 'icmp6()/icmpv6()' trafgen generation function. Fields supported: mtype Message type (default: 0) Supported keywords: echorequest, echoreply code Code (default: 0) csum Message checksum (calculated by default) Examples: { eth(), ipv6(daddr=::1), icmpv6(echorequest), 42, 42, 0, 0 }' If not explicitely specified, the lower header is initialized as Ethernet. Suggested-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-25trafgen: proto: Add IPv6 header generationTobias Klauser1-1/+38
Support for generating simple IPv6 headers using the 'ip6()/ipv6()' trafgen generation function. Fields supported: ver|version Version (default: 6) tc|tclass Traffic class (default: 0) fl|flow Flow Label (default: 0) len|length Payload length (calculated by default) nh|nexthdr Type of next header (default: 0) hl|hoplimit|ttl Hop Limit, TTL (default: 0) sa|saddr Source IPv6 address (default: device address) da|daddr Destination IPv6 address (default: 0:0:0:0:0:0:0:0) Examples: { eth(), ipv6(daddr=1:2:3:4:5:6:7:8) } { ipv6(tc=2, hl=3, daddr=::1) } { eth(), ipv6(nh=58, sa=2001:db8::, da=::1), 128, 0, 0x52, 0x03, 0, 0, 0, 0 } If not explicitely specified, the lower header is initialized as Ethernet. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-22man: trafgen: Add example program, rewritten using the trafgen functionsTobias Klauser1-0/+13
Show how the trafgen header generation functions can make a trafgen script much more concise by rewritting Jesper's example using these functions. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-02-23trafgen: man: Add description for 'mpls()' functionVadim Kochan1-2/+27
Add syntax & fields description for 'mpls()' function, also: 1) add line break for VLAN header notes 2) fix ip -> ipv4 in UDP echo example 3) consistent spelling of EtherType Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-02-02trafgen: man: Add help for VLAN header functionVadim Kochan1-0/+29
Add usage, syntax & parameters description for 'vlan()' function. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-02-01trafgen: parser: Add TCP header generation functionTobias Klauser1-0/+59
Add a function 'tcp()' to generate TCP headers from the trafgen configuration language. Fields supported: sp|sport TCP source port (default 0) dp|dport TCP destination port (default 0) seq Sequence number (default: 0) aseq|ackseq Acknowledgement number (default 0) doff|hlen Header length/data offset (default: 5) cwr Congestion Window Reduced flag (default: 0) ece|ecn ECN-Echo flag (default: 0) urg Urgent flag (default: 0) ack Acknowledgement flag (default: 0) psh Push flag (default: 0) rst Reset flag (default: 0) syn Synchronize flag (default: 0) fin Finish flag (default: 0) win|window Receive window size (default: 0) csum Checksum field (calculated automatically) urgptr Urgent pointer (default: 0) Example (SYN on port 80/http): { tcp(dport=80, syn, window=5840) } Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-01-29trafgen: parser: Support "etype"/"type" keywords for EthertypeTobias Klauser1-2/+2
The IEEE 802.3 standard commonly refers to the field specifying the upper layer protocol as Ethertype, not protocol. Thus, also support the keywords "etype" and "type" for this field. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-01-29man: trafgen: Remove double wordTobias Klauser1-2/+2
s/packet packet/packet/ Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-01-29trafgen: man: Add help for Ethernet, ARP, IPv4, UDP headersVadim Kochan1-0/+168
Add description (basic syntax, proto header fields) for newer added proto headers: Ethernet, ARP, IPv4, UDP. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> [tk: reworded and reformatted a few parts] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-01-05trafgen: Fix typo of kbit in usage and manpageTobias Klauser1-1/+1
Use 'kbit' instead of kBit in usage and manpage to actually reflect what trafgen expects. Fixes: 9ece0fe02096 ("trafgen: Add option to specify packets sending rate") Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-01-05trafgen: Add option to specify packets sending rateVadim Kochan1-0/+4
Added -b,--rate option in units of: pps/B/kB/MB/kBit/Mbit/Gbit/KiB/MiB/GiB to specify rate at which packets will be sent. Similarly to -t,--gap option the packets will be sent in slow mode with 1 CPU. Tested with ifpps. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-12-17trafgen: Added option to pass macro/define for C preprocessorVadim Kochan1-0/+4
Add -D,--define option which allows to pass multiple macro/defines which can be used in trafgen script (e.g. by #ifdef ). Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-09trafgen: Allow to build packet from command lineVadim Kochan1-1/+7
Craft packet directly from command line with same syntax as for conf file. It might be as first step to extend current syntax with specific proto fields. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-13trafgen: Add checksum helpers for TCP/UDP over IPv6Tobias Klauser1-0/+2
Add the csumudp6 and csumtcp6 helper functions in order to simplify checksum generation for TCP/UDP packets sent over IPv6. trafgen example for TCP over IPv6: { /* MAC Destination */ fill(0xff, 6), /* MAC Source */ 0x00, 0x02, 0xb3, drnd(3), /* IPv6 Protocol */ c16(0x86DD), /* Version, Traffic Class, Flow Label */ 0b01100000, c8(0), c16(0), /* Payload Length */ c16(54), /* Next Header (TCP) */ c8(6), /* Hop Limit */ c8(64), /* Source IPv6 */ 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, 0xac, 0x6f, 0xff, 0xfe, 0xa4, 0x12, 0xe3, /* Destination IPv6 */ 0xfe, 0x80, 0x82, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xff, 0xfe, 0x00, 0x06, 0xde, /* TCP Source Port */ c16(55042), /* TCP Destination Port */ c16(55043), /* TCP Sequence Number */ drnd(4), /* TCP Ackn. Number */ c32(0), /* TCP Header length + TCP SYN/ECN Flag */ c16((8 << 12) | (1 << 1) | (1 << 6)) /* Window Size */ c16(16), /* TCP Checksum (offset IPv6, offset TCP) */ csumtcp6(14, 54), /* TCP Options */ 0x00, 0x00, 0x01, 0x01, 0x08, 0x0a, 0x06, 0x91, 0x68, 0x7d, 0x06, 0x91, 0x68, 0x6f, /* Data blob */ "foobar!", } Suggested-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-08-21trafgen: add option to not adjust system socket mem during testrunJesper Dangaard Brouer1-0/+9
The default behavior of trafgen is to boost the systems default socket memory limits during a testrun. This behaviour does not always result in improved performance, because this will stress the kernels SLAB allocators unnecessary. Introducing an option "--no-sock-mem" that instruct trafgen to not perform any socket memory adjustments. Fixes: #130 Acked-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2014-05-03doc: Fix typos in mausezahn and trafgen manpagesKartik Mistry1-1/+1
Fixed typos in mausezahn.8 and trafgen.8 [tklauser: Slightly edited commit message] Signed-off-by: Kartik Mistry <kartik.mistry@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-04-30trafgen: Don't expose -k/--kernel-pull anymore and warn if it still usedTobias Klauser1-5/+0
The -k/--kernel-pull option got useless with commit c139e80 ("trafgen: remove timer-based trigger model"). Instead of entirely removing it and thus possibly breaking people's scripts, still accept it as an option, but warn the user about it. We might want to remove the option in a future release. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-03-14man: manpage warning fixesKartik Mistry1-2/+1
Usage: man --warnings -E UTF-8 -l -Tutf8 -Z foo.8 > /dev/null Signed-off-by: Kartik Mistry <kartik.mistry@gmail.com>
2013-12-12trafgen: take advantage of PACKET_QDISC_BYPASS sock optionJesper Dangaard Brouer1-0/+6
Since Linux 3.14, the kernel supports a socket option PACKET_QDISC_BYPASS, which trafgen enables by default. That allow us to bypass the kernels normal qdisc (traffic control) layer. An option -q, --qdisc-path is added to allow enabling the qdisc path explicity, useful for testing purposes. This will be avail in kernels >= 3.14 via commit d346a3fae3 (packet: introduce PACKET_QDISC_BYPASS socket option). Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2013-11-25trafgen: inherit netsniff-ng's -H -Q optionsDaniel Borkmann1-0/+9
Also make these options available to trafgen. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-10-15trafgen: set interpacket gap in time units (s/ms/us/ns)Jon Schipp1-9/+11
Add ability to set IGP in time units in seconds, milliseconds, microseconds, and nanoseconds by appending a postfix to --gap e.g. --gap 100ms. Also, update the man page and trafgen.zsh to reflect the changes. [Fix whitespaces, coding style and minor wording changes -- tklauser] Signed-off-by: Jon Schipp <jonschipp@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2013-07-29man: Align synopsis with other sectionsTobias Klauser1-1/+1
In all the tools' man pages the synopsis line is indented by one space with respect to the text in the sections above and below. Remove the space to have consistent alignment. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2013-07-13trafgen: switch for skipping cpu time statistics on exitDaniel Borkmann1-0/+3
For systems with >8 CPUs it might be i) annoying or ii) uninteresting to print CPU time statistics. So introduce a switch that can skip this at exit. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-06-17man: add colophon to the end of each document.Daniel Borkmann1-0/+4
Add a colophon to the end of each man page. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-06-15trafgen: fix checksumming in trafgen example configDaniel Borkmann1-1/+1
Took quite a while to git bisect the cause for the wrong TCP checksum in the -e example. It turned out that commit bf43e1993c7037 ("trafgen: lexer: return original string if no shellcode") "broke" it, since before that commit the TCP checksum from -e example was correct and afterwards not anymore. Well, it didn't break it. What was happening here is that with this fix above, the packet got 1 byte longer since the first character of the example string is not omitted anymore, therefore the checksum got wrong. Fix this by fixing the IP total length of the packet in the -e and man page example. The UDP example from the man page still works well if csumudp() is used, so not affected of this. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-06-14man: trafgen: fix remaining `` occurencesDaniel Borkmann1-23/+23
That's the last man page where `` occurs, so fix this up by making it consistentlt '' as the rest of all man pages. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-05-30man: manpages hyphen and spelling mistakesKartik Mistry1-4/+4
Some fixes all over, part 1. Signed-off-by: Kartik Mistry <kartik@debian.org> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-05-27man: minor: trafgen: add .PPs and modify BUGS sectionDaniel Borkmann1-81/+82
Minor change in BUGS section to bring it up to date. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-05-23man: trafgen: corrections and various edits to manual pageJon Schipp1-16/+16
Signed-off-by: Jon Schipp <jonschipp@gmail.com> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-05-15man: trafgen: Minor fixesTobias Klauser1-13/+14
Replace "on default" by "by default", make it a bit more clear what the seed in the -E/--seed option is for and mention exit after display of information on --version and --help. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2013-05-15man: trafgen: Complete documentation for option -p/--cppTobias Klauser1-1/+3
Add complete description of the commandline option -p/--cpp to the manpage. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2013-05-10man: trafgen: update documentation for hex, bin formsDaniel Borkmann1-2/+2
Also update examples for the man-page. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-05-05misc: move file to source rootDaniel Borkmann1-0/+445
Only have Makefile specific folders in the project root where the binaries are stored, the rest should be part of the repository root. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>