C Roff Yacc Shell Makefile Lex Other
Latest commit 443d975 Sep 13, 2017 Paolo Abeni committed with tklauser trafgen: fix packet socket initialization with multiple CPUs
The commit 78c13b7 ("trafgen: Allow to generate packets
to output pcap file") introduced a regression when output is
a network device and multiple CPU are in use: the packet
socket is created before fork() and thus the socket is shared
among all the processes: all of them except the first will
fail while setting the tx_ring.

Fix it splitting the io open() helper in a create() op,
called before forking, and the open() op called by each process.

Fixes: 78c13b7 ("trafgen: Allow to generate packets to output pcap file")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Permalink
Failed to load latest commit information.
astraceroute bpf: Use sysctl helpers to enable bpf jit compiler Jul 20, 2015
bpfc make: Fix spelling yaac -> yacc Feb 9, 2017
curvetun build: curvetun: link against sysctl.o Aug 5, 2015
flowtop flowtop: take PKG_CONFIG into account for libnetfilter_conntrack May 23, 2017
ifpps sock: Use sysctl helpers to access /proc/sys/ params Jul 20, 2015
mausezahn mz: Check device argument by ifindex instead of name prefix Sep 21, 2016
netsniff-ng netsniff-ng: Allow to compile without libnl Aug 5, 2016
staging mausezahn: fix segmentation fault Jul 25, 2017
trafgen trafgen: Dump proto headers in *.cfg format Aug 10, 2017
.gitattributes gittattributes: Exclude dotfiles from created archives Dec 22, 2016
.gitignore gittattributes: Exclude dotfiles from created archives Dec 22, 2016
.travis.yml build: configure: Allow to compile tools without libnl Aug 5, 2016
AUTHORS AUTHOR: add Zhouyang Jia Jul 25, 2017
COPYING docs: minor: fix whitespacing in copying file May 29, 2013
Cmds build: Don't show echo commands in verbose mode Feb 9, 2017
CodingStyle docs: minor: fix mentioning of Documentation/ May 10, 2013
Extra build: reduce Extra contents to bare minimum Jul 30, 2013
INSTALL build: configure: Use command line options to disable optional libraries Aug 4, 2016
Makefile make: use sed instead of perl to extract lex/yacc prefix May 3, 2017
Misc build: misc: Adjust coverity scanner URL Dec 10, 2015
README docs: be more precise on readme with experimental tools Apr 10, 2014
README.devel doc: Document Travis CI Coverity integration Apr 29, 2016
REPORTING-BUGS docs: REPORTING-BUGS: Mention the github issue tracker May 7, 2015
SubmittingPatches docs: move some of them to the root directory Apr 11, 2013
Template make: Fix spelling yaac -> yacc Feb 9, 2017
astraceroute.8 man: astraceroute: Fix closing quotation mark Apr 22, 2014
astraceroute.c all: use <net/*> headers instead of <linux/*> where possible May 10, 2017
astraceroute.zsh zsh: Unify completion help messages for --version and --help Mar 23, 2014
bpf.c netsniff-ng: Allow to specify compiled BPF from stdin Nov 10, 2015
bpf.h bpf: Fix confusing panic() message Dec 16, 2016
bpf.vim vim: add bpf syntax highlighting file May 13, 2013
bpf_comp.c bpf: Fix confusing panic() message Dec 16, 2016
bpf_ext.h bpf: split up instructions and extensions from header Jun 4, 2013
bpf_insns.h bpf: use Linux' define of BPF_MAXINSNS Jun 15, 2013
bpf_jit_disasm.c bpf: add minimal BPF JIT emitted image disassembler May 27, 2013
bpf_lexer.l bpfc: add gnu as style %-register prefix Sep 6, 2013
bpf_parser.y bpfc: disable NLS in the parser May 12, 2017
bpfc.8 bpfc: Add option to pass macro/define for C preprocessor Dec 17, 2015
bpfc.c bpfc: make verbose parameter boolean Dec 10, 2016
bpfc.zsh zsh: bpfc: Add completion for -D/--define Dec 17, 2015
built_in.h built_in: don't redefine memcpy/memset May 12, 2017
colors.h colorize: Squash colorize macros into colors.h Aug 12, 2016
configure build: configure: rewrap missing defs warning Dec 1, 2016
conntrack.h conntrack: consolidate all conntrack header includes into conntrack.h Jul 8, 2013
cookie.c xio: refactor fopencookie related functions Jun 4, 2013
cookie.h xio: refactor fopencookie related functions Jun 4, 2013
corking.c misc: remove two header comments Jun 15, 2013
corking.h corking: use bool instead of int Jun 3, 2013
cpp.c cpp: Use mkstemps() to create unique temporary file Apr 26, 2016
cpp.h cpp: Constify cpp argv passed to cpp_exec Dec 17, 2015
cpus.h cpus: let it always return an unsigned int and bail out on error Jun 12, 2013
cpusched.c xmalloc: Add and use xcalloc Jun 25, 2014
cpusched.h cpusched: remove useless header comment Jun 3, 2013
crypto.h curve: curve25519_encode/curve25519_decode: simplify crypto transforms Jun 15, 2013
csum.h built_in: don't redefine memcpy/memset May 12, 2017
curve.c curve: free buffers in reverse order to allocation Jun 15, 2013
curve.h curve: curve25519_tfm_alloc/curve25519_tfm_free helpers Jun 15, 2013
curve_test.c curve: move selftest to own file Jun 10, 2013
curvetun.8 man: Correct some typos found using codespell Sep 24, 2015
curvetun.c all: Remove unused longindex parameter to getopt_long() Dec 8, 2016
curvetun.h built_in: changed to use RUNTIME_PAGE_SIZE instead of PAGE_SIZE Apr 12, 2014
curvetun.zsh zsh: add netsniff-ng zsh auto completion support May 13, 2013
curvetun_client.c poll: changed to include <poll.h> instead of <sys/poll.h> Apr 10, 2014
curvetun_mgmt.h curvetun_mgmt: consolidate the two mgmt include files into one Jul 11, 2013
curvetun_mgmt_servers.c curvetun: renamed client, server, and management files Jul 11, 2013
curvetun_mgmt_servers.h curvetun: renamed client, server, and management files Jul 11, 2013
curvetun_mgmt_users.c curvetun: Fix issues detected by the Coverity scanner Sep 7, 2015
curvetun_mgmt_users.h curvetun: renamed client, server, and management files Jul 11, 2013
curvetun_server.c xmalloc: Add and use xcalloc Jun 25, 2014
dev.c dev: only calculate wireless bitrate if necessary Sep 13, 2017
dev.h dev: only calculate wireless bitrate if necessary Sep 13, 2017
die.c die: Rename *_panic_func to *_panic_handler May 5, 2015
die.h die: Rename *_panic_func to *_panic_handler May 5, 2015
dissector.c netsniff-ng: Add dissector for Linux "cooked" packets Jun 19, 2015
dissector.h netsniff-ng: Allow to compile without libnl Aug 5, 2016
dissector_80211.c lookup: Use lookup module for OUI lookup as well Nov 16, 2015
dissector_80211.h dissector: Get rid of now unnecessary HAVE_DISSECTOR_PROTOS Jun 16, 2014
dissector_eth.c lookup: Use lookup module for OUI lookup as well Nov 16, 2015
dissector_eth.h dissector: Get rid of now unnecessary HAVE_DISSECTOR_PROTOS Jun 16, 2014
dissector_fuzz.sh misc: move file to source root May 5, 2013
dissector_netlink.c netsniff-ng: Allow to compile without libnl Aug 5, 2016
dissector_netlink.h netsniff-ng: Allow to compile without libnl Aug 5, 2016
dissector_sll.c netsniff-ng: Allow to compile without libnl Aug 5, 2016
dissector_sll.h netsniff-ng: Add dissector for Linux "cooked" packets Jun 19, 2015
epoll2.c xutils: eliminate xutils, move rest to epoll2 Jun 4, 2013
epoll2.h xutils: eliminate xutils, move rest to epoll2 Jun 4, 2013
ether.conf misc: move file to source root May 5, 2013
flowtop.8 flowtop: man: Add how-to activate conntrack by modprobe Apr 22, 2016
flowtop.c flowtop: Move out stats fields from flow & proc entry Jun 2, 2017
flowtop.zsh zsh: flowtop: Add completion for newly added command line options Oct 29, 2015
geoip.c geoip: Fix memory leak when using GeoIPRecord Feb 6, 2017
geoip.conf misc: move file to source root May 5, 2013
geoip.h geoip: adjust geoip{4,6}_{city,region}_name prototypes for !HAVE_GEOIP May 3, 2017
hash.c xmalloc: Add and use xcalloc Jun 25, 2014
hash.h misc: cleanup header comments Jun 4, 2013
ifpps.8 man: manpage warning fixes Mar 14, 2014
ifpps.c ifpps: fix unintendet assignment Sep 13, 2017
ifpps.zsh zsh: Unify completion help messages for --version and --help Mar 23, 2014
ioexact.c ioexact: make mayexit a bool Jun 17, 2013
ioexact.h ioexact: make mayexit a bool Jun 17, 2013
ioops.c ioops: Add mkostemp_or_die() wrapper for mkostemp(3) Apr 26, 2016
ioops.h ioops: Add mkostemp_or_die() wrapper for mkostemp(3) Apr 26, 2016
iosched.c iosched: Print error cause if setting io prio failed Apr 22, 2015
iosched.h iosched: break out io scheduling functions from xutils Jun 3, 2013
ipv4.h misc: cleanup header comments Jun 4, 2013
ipv6.h misc: cleanup header comments Jun 4, 2013
irq.c irq: do not process non-existant irq number of lo Jun 10, 2013
irq.h irq: rename device_bind_irq_to_cpu to device_set_irq_affinity Jun 4, 2013
keypair.c keypair: add missing include file Jun 12, 2013
keypair.h keypair: Add routines to generate and verify a keypair Jun 4, 2013
link.c link: use uint32_t instead of u32 Sep 13, 2017
link.h link: use uint32_t instead of u32 Sep 13, 2017
linktype.h linktype: Add LINKTYPE_LINUX_SLL. Jun 17, 2015
locking.h Revert "flowtop: Don't init screen until collector is ready" Jul 20, 2015
lockme.h xutils: break out string handling and locking Jun 3, 2013
lookup.c lookup: Return const char * from all lookup functions Nov 16, 2015
lookup.h lookup: Return const char * from all lookup functions Nov 16, 2015
mac80211.c trafgen: Allow to compile without libnl Aug 5, 2016
mac80211.h trafgen: Allow to compile without libnl Aug 5, 2016
mausezahn.8 man: mausezahn: Add -6 option to manpage Nov 18, 2016
mausezahn.zsh mausezahn: bind to IP address in interactive mode Jul 25, 2014
netsniff-ng.8 man: netsniff-ng: Fix usage example description Jun 22, 2016
netsniff-ng.c netsniff-ng: fix --bind-cpu option in example command line Jun 27, 2017
netsniff-ng.zsh zsh: netsniff-ng: Add completetion for --cooked Aug 6, 2015
oui-update.py oui-update: Explicitly sort OUI list and strip trailing whitespaces Oct 13, 2015
oui.conf conf: oui: update oui.conf Oct 13, 2015
patricia.c all: import netsniff-ng 0.5.8-rc0 source Mar 15, 2013
patricia.h all: import netsniff-ng 0.5.8-rc0 source Mar 15, 2013
pcap_io.h all: use <net/*> headers instead of <linux/*> where possible May 10, 2017
pcap_mm.c netsniff-ng: Don't set IO prio when reading pcap file Apr 22, 2015
pcap_rw.c netsniff-ng: Don't set IO prio when reading pcap file Apr 22, 2015
pcap_sg.c netsniff-ng: Don't set IO prio when reading pcap file Apr 22, 2015
pkt_buff.h pkt_buff: Remove unused size member from struct pkt_buff Oct 20, 2015
privs.c privs: move drop_privileges out of xutils Jun 4, 2013
privs.h privs: move drop_privileges out of xutils Jun 4, 2013
proc.c flowtop: Add process UI tab entry Jan 25, 2017
proc.h proc.h: add missing headers May 23, 2017
proto.h netsniff-ng: proto: Make raw hex/ascii print function globally available Oct 19, 2015
proto_80211_mac_hdr.c lookup: Use lookup module for OUI lookup as well Nov 16, 2015
proto_arp.c dissectors: arp: Simplify arp_print_addrs() Jan 26, 2016
proto_ethernet.c dissectors: ethernet: Don't resolve OUI for locally administered addr… Aug 2, 2016
proto_icmpv4.c csum: Remove unused parameter from calc_csum() Nov 9, 2015
proto_icmpv6.c all: Fix some typos in comments and printed strings Sep 24, 2015
proto_igmp.c dissectors: igmp: Fix calc_csum() calls Nov 9, 2015
proto_ip_authentication_hdr.c netsniff-ng: Rename protocol dissector member of struct pkt_buff May 4, 2015
proto_ip_esp.c dissectors: Include protos.h in some dissectors for protocol ops decl… Aug 15, 2014
proto_ipv4.c geoip: Fix memory leak when using GeoIPRecord Feb 6, 2017
proto_ipv6.c geoip: Fix memory leak when using GeoIPRecord Feb 6, 2017
proto_ipv6_dest_opts.c netsniff-ng: Rename protocol dissector member of struct pkt_buff May 4, 2015
proto_ipv6_fragm.c netsniff-ng: Rename protocol dissector member of struct pkt_buff May 4, 2015
proto_ipv6_hop_by_hop.c netsniff-ng: Rename protocol dissector member of struct pkt_buff May 4, 2015
proto_ipv6_in_ipv4.c dissectors: Get rid of unecessary includes of protos.h Feb 24, 2014
proto_ipv6_mobility_hdr.c netsniff-ng: Rename protocol dissector member of struct pkt_buff May 4, 2015
proto_ipv6_no_nxt_hdr.c dissectors: Get rid of unecessary includes of protos.h Feb 24, 2014
proto_ipv6_routing.c netsniff-ng: Rename protocol dissector member of struct pkt_buff May 4, 2015
proto_lldp.c lookup: Use lookup module for OUI lookup as well Nov 16, 2015
proto_mpls_unicast.c netsniff-ng: Rename protocol dissector member of struct pkt_buff May 4, 2015
proto_nlmsg.c all: use <net/*> headers instead of <linux/*> where possible May 10, 2017
proto_none.c netsniff-ng: proto: Make raw hex/ascii print function globally available Oct 19, 2015
proto_tcp.c lookup: Return const char * from all lookup functions Nov 16, 2015
proto_udp.c lookup: Return const char * from all lookup functions Nov 16, 2015
proto_vlan.c netsniff-ng: Rename proto_vlan.h to vlan.h Jan 27, 2016
proto_vlan_q_in_q.c netsniff-ng: Rename protocol dissector member of struct pkt_buff May 4, 2015
protos.h netsniff-ng: Add netlink dissector May 28, 2014
ring.c ring: Remove unused parameter sock from setup_ring_layout_generic() Apr 27, 2016
ring.h all: fix build on CentOS 6 by checking presence of several macros Sep 29, 2016
ring_rx.c all: fix build on CentOS 6 by checking presence of several macros Sep 29, 2016
ring_rx.h netsniff-ng: Show total rx stats for multi pcap mode Aug 25, 2015
ring_tx.c ring: Remove unused parameter sock from setup_ring_layout_generic() Apr 27, 2016
ring_tx.h ring: Merge common ring_{rx,tx} initialization into own function May 9, 2014
rnd.c rnd: Fix compiler warning Aug 11, 2013
rnd.h rnd: add gen_key_bytes to generate key from good entropy source Jun 4, 2013
screen.c ifpps, flowtop: Move ncurses init and end to common module Jun 24, 2013
screen.h screen: Add helpers to easy use color by name Apr 18, 2016
sig.c sig: add signal handling functions Jun 4, 2013
sig.h sig: add signal handling functions Jun 4, 2013
sock.c sock: change type of verbose parameter to set_sock_qdisc_bypass() Dec 10, 2016
sock.h sock: change type of verbose parameter to set_sock_qdisc_bypass() Dec 10, 2016
str.c str: Add function for converting string into DNS name Jun 2, 2017
str.h str: Add function for converting string into DNS name Jun 2, 2017
stun.c stun: close socket before returning in error case Jun 12, 2013
stun.h stun: add header file Jun 4, 2013
sysctl.c sysctl: Export procfs base path in sysctl.h Jul 30, 2015
sysctl.h sysctl: Export procfs base path in sysctl.h Jul 30, 2015
taia.c taia: minor: add comment about window Jun 10, 2013
taia.h taia: minor: small cleanup and comment Jun 10, 2013
tcp.conf misc: move file to source root May 5, 2013
timer.c netsniff-ng, nlmsg: add further rtnl route type messages to dissector Jun 5, 2015
timer.h netsniff-ng, nlmsg: add further rtnl route type messages to dissector Jun 5, 2015
tprintf.c build: Define _DEFAULT_SOURCE to fix compilation warnings with glibc>… Apr 17, 2016
tprintf.h colorize: Squash colorize macros into colors.h Aug 12, 2016
trafgen.8 trafgen: Dump proto headers in *.cfg format Aug 10, 2017
trafgen.c trafgen: fix packet socket initialization with multiple CPUs Sep 15, 2017
trafgen.zsh zsh: trafgen: Add missing option -q/--qdisc-path to zsh completion Dec 13, 2016
trafgen_conf.h trafgen: Dump proto headers in *.cfg format Aug 10, 2017
trafgen_dev.c trafgen: fix packet socket initialization with multiple CPUs Sep 15, 2017
trafgen_dev.h trafgen: fix packet socket initialization with multiple CPUs Sep 15, 2017
trafgen_dump.c trafgen: Dump proto headers in *.cfg format Aug 10, 2017
trafgen_dump.h trafgen: Dump proto headers in *.cfg format Aug 10, 2017
trafgen_l2.c trafgen: Dump proto headers in *.cfg format Aug 10, 2017
trafgen_l2.h trafgen: l2: Add support for PFC header Oct 4, 2016
trafgen_l3.c trafgen: Dump proto headers in *.cfg format Aug 10, 2017
trafgen_l3.h trafgen: proto: Use field id as array index Aug 5, 2016
trafgen_l4.c trafgen: Get packet from proto_hdr if possible Aug 10, 2017
trafgen_l4.h trafgen: proto: Add ICMPv4 header generation Jul 13, 2016
trafgen_l7.c trafgen: l7: Add DNS header generation API Jun 2, 2017
trafgen_l7.h trafgen: l7: Add DNS header generation API Jun 2, 2017
trafgen_lexer.l trafgen: parser: Add syntax to generate DNS header Jun 2, 2017
trafgen_parser.y trafgen: Dump proto headers in *.cfg format Aug 10, 2017
trafgen_proto.c trafgen: Dump proto headers in *.cfg format Aug 10, 2017
trafgen_proto.h trafgen: Dump proto headers in *.cfg format Aug 10, 2017
trafgen_stddef.h trafgen: Add checksum helpers for TCP/UDP over IPv6 Oct 13, 2015
trie.c all: import netsniff-ng 0.5.8-rc0 source Mar 15, 2013
trie.h trie: remove useless header comment Jun 3, 2013
tstamping.c configure: fix multiple issues in build configuration Jul 9, 2013
tstamping.h configure: fix multiple issues in build configuration Jul 9, 2013
udp.conf misc: move file to source root May 5, 2013
ui.c flowtop: Improve and unify up/down scrolling May 30, 2017
ui.h flowtop: Improve and unify up/down scrolling May 30, 2017
urcu-list-compat.h flowtop: Add tab control to switch between tables Jan 25, 2017
vlan.h netsniff-ng: Rename proto_vlan.h to vlan.h Jan 27, 2016
xmalloc.c build: fix compilation warnings with _GNU_SOURCE Apr 17, 2016
xmalloc.h xmalloc: Add attribute warn_unused_result to allocation functions Apr 7, 2015

README

//////////////////////////////////////////////////////////////////////////////

                    netsniff-ng - the packet sniffing beast

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
                                         .      .
netsniff-ng is a free, performant       /(      )\
Linux network analyzer and            .' {______} '.
networking toolkit. If you will,       \ ^,    ,^ /
the Swiss army knife for network        |'O\  /O'|   _.<0101011>--
packets.                                > `'  '` <  /
                                        ) ,.==., (  |
Web: http://netsniff-ng.org          .-(|/--~~--\|)-'
                                    (      ___
The gain of performance is           \__.=|___E
reached by built-in zero-copy
mechanisms, so that on packet reception and transmission the kernel does not
need to copy packets from kernel space to user space, and vice versa.

The netsniff-ng toolkit's primary usage goal is to facilitate a network
developer's / hacker's daily Linux plumbing. It can be used for network
development, debugging, analysis, auditing or network reconnaissance. It
consists of the following fixed set of utilities:

  * netsniff-ng: a zero-copy packet analyzer, pcap capturing/replaying tool
  * trafgen: a multithreaded low-level zero-copy network packet generator
  * mausezahn [*]: high-level packet generator for appliances with Cisco-CLI
  * ifpps: a top-like kernel networking and system statistics tool
  * curvetun [*]: a lightweight curve25519-based multiuser IP tunnel
  * astraceroute: an autonomous system trace route and DPI testing utility
  * flowtop: a top-like netfilter connection tracking tool
  * bpfc: a [seccomp-]BPF (Berkeley packet filter) compiler, JIT disassembler

Note that tools marked with [*] should be considered as experimental for now,
and not used in production environments as they still need more work to be
fully stable and in line with others. You have been warned!

Each release can be verified with Git and GPG, here are the steps to do so:

 1) Import the maintainers public keys:
   git show maint-tklauser-pgp-pub | gpg --import
   git show maint-dborkman-pgp-pub | gpg --import
 2) Verify the Git tag:
   git tag -v <tag-name>

Carefully read the INSTALL document for the next steps in building netsniff-ng.
Note that the toolkit is still quite young and under heavy development, not
yet feature complete and in a quality level where we're satisfied with (i.e.
for mausezahn). However, we're on a good way towards tackling all these goals.

The netsniff-ng toolkit is an open source project covered by the GNU General
Public License, version 2.0. For any questions or feedback about netsniff-ng
you are welcome to leave us a message at <netsniff-ng@googlegroups.com>.

netsniff-ng is non-profit and provided in the hope, that it is found useful.
The current project status can be considered as "working". In general, all tools
have been tested by us to a great extend including their command-line options.
In fact, many of our tools are used in a lot of production systems. However, we
give no guarantee that our tools are free of bugs! If you spot some issues,
contact us as described in REPORTING-BUGS. Also, have a look at our online FAQ
for answering your questions. This project has received support from companies
and institutions listed in the according section in the AUTHORS file. Thanks for
contributing, we're thrilled to provide you with netsniff-ng! Happy packet
hacking!