summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2014-08-14dissector: check for correct netlink linktypeDaniel Borkmann1-1/+4
It's supposed to be LINKTYPE_NETLINK, not AF_NETLINK as otherwise the pkt_type fixup cannot be done correctly. Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-08-14netsniff-ng: Restore tpacket v2 capturingTobias Klauser7-13/+109
Some older systems (e.g. RHEL 6) don't have tpacket v3 available, but only tpacket v2. However, since commit d8cdc6a ("ring: netsniff-ng: migrate capture only to TPACKET_V3") we solely rely on tpacket v3 for capturing packets. This patch restores the possibility to capture using tpacket v2. For now this is just a fallback if the configure script doesn't detect tpacket v3 (and thus HAVE_TPACKET3 isn't set). Thus, on most modern systems this shouldn't change anything and they will continue using tpacket v3. For now this fix contains quite a bit of ugly #ifdefery which should be cleaned up in the future. Fixes #76 Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-08-13netsniff 0.5.9-rc3v0.5.9-rc3Tobias Klauser1-1/+1
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-08-12netsniff-ng: Add command line option to disable hardware time stampingTobias Klauser3-5/+21
Allow to disable hardware time stamping using the command line switch (-N/--no-hwtimestamp). This might be useful in situations where hardware time stamps are skewed somehow. Reference: #129 Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-08-08AUTHORS: Add Jon Schipp to major contributors listJon Schipp1-1/+1
Github shows 33 commits for me: https://github.com/netsniff-ng/netsniff-ng/graphs/contributors $ git shortlog | grep -i jon Jon Schipp (29): jonschipp (1): Not sure what the difference is here, but this one will make 31 based on git shortlog (I hope that's not cheating) :) Otherwise I can wait. And I believe I have a few commits from the old history (is this still up somewhere?). I think it used to be on the cryptoism site. Signed-off-by: Jon Schipp <jschipp@illinois.edu> Acked-by: Daniel Borkmann <borkmann@iogearbox.net> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-08-07dissectors: Use __packed macro instead of open-coding itTobias Klauser2-6/+6
Consistently vse the __packed macro defined in built_in.h instead of __attribute__((packed)) in all dissectors (and the entire code base for that matter). Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-08-05mausezahn: provide listen-addr option to configuration fileJon Schipp3-5/+9
Specify the listen-addr for the CLI in /etc/netsniff-ng/mausezahn.conf and remove the message, "mz: device not given, will use eth0" since we're listening by IP, rather than interface now, and this shows continues to show. $ grep listen-addr /etc/netsniff-ng/mausezahn.conf listen-addr = 127.0.0.1 $ mausezahn -V -x mz: device eth0 got assigned 10.0.2.15 and is a possible candidate. mz: device lo got assigned 127.0.0.1 (loopback) Opening config file /etc/netsniff-ng/mausezahn.conf... ... Mausezahn accepts incoming Telnet connections on 127.0.0.1:25542. Signed-off-by: Jon Schipp <jonschipp@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-08-04man: mausezahn: document rest of available config file optionsJon Schipp1-1/+3
This documents two more configuration file options that can be used. One, automops, is in the development phase (not compiled by default), and the other one, management-only, is usable. It prevents a user from using a network interface to pass data traffic with the intention that the interface is used for machine managment (remote control). $ cat /etc/netsniff-ng/mausezahn.conf user = mzadmin password = better-password management-only = eth0 automops = /path/to/an/automops-file.xml Signed-off-by: Jon Schipp <jonschipp@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-08-04mausezahn: provide port option to configuration fileJon Schipp3-7/+12
Specify the port for the CLI in /etc/netsniff-ng/mausezahn.conf like so: $ grep port /etc/netsniff-ng/mausezahn.conf port = 65000 $ mausezahn -V -x -l 127.0.0.1 Mausezahn 0.40 - (C) 2007-2010 by Herbert Haas - http://www.perihel.at/sec/mz/ Use at your own risk and responsibility! -- Verbose mode -- ... Opening config file /etc/netsniff-ng/mausezahn.conf... ... Mausezahn accepts incoming Telnet connections on 127.0.0.1:65000. Signed-off-by: Jon Schipp <jonschipp@gmail.com> [tklauser: Fixed whitespace issues for patch to apply cleanly] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-07-28man: mausezahn: document configuration file optionsJon Schipp1-6/+27
Signed-off-by: Jon Schipp <jonschipp@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-07-28mausezahn: cli.h: increase buffer sizeJon Schipp1-1/+1
Tobias pointed out and fixed in commit 9ef1dd15551f ("mausezahn: Increase buffer size for listen address string") that the buffer isn't log enough to hold the null terminator character. The declaration of the buffer in cli.h was missed though. Signed-off-by: Jon Schipp <jonschipp@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch> [commit msg edited]
2014-07-28mausezahn: change configuration file name to mausezahn.confJon Schipp2-3/+3
Commit 134a7beb7ab ("mausezahn: re-work configuration file") changed mausezahn to look for the configuration file in /etc/netsniff-ng. The filename was intended to be mausezahn.conf not mausezahn.cfg to fit with the other *.conf file extensions in /etc/netsniff-ng, so change it now. Signed-off-by: Jon Schipp <jonschipp@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch> [commit msg edited]
2014-07-25mausezahn: Increase buffer size for listen address stringTobias Klauser1-1/+1
Commit 2de653340c ("mausezahn: bind to IP address in interactive mode") introduced mz_listen_addr of size 15 to hold the IP address to bind to. Since an address can be maximum 15 characters long, this doesn't account for the terminating '\0'. Fix this by increasing the buffer size to 16. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-07-25mausezahn: bind to IP address in interactive modeJon Schipp5-3/+13
Adds new option ``-l'' that can be used to set mausezahn's listen address to bind to an IP of choice. e.g. mausezahn -l 127.0.0.1 -x Signed-off-by: Jon Schipp <jonschipp@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-07-25mausezahn.8: minor edits to improve formatJon Schipp1-10/+9
Signed-off-by: Jon Schipp <jonschipp@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-07-23build: flowtop: Only build ioops with GeoIP support enabledTobias Klauser2-3/+2
Follow commit 9ad7f8882097 ("build: astraceroute: Only build ioops with GeoIP support enabled"). The ioops module is only needed in geoip.o, thus make it dependent on CONFIG_GEOIP. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-07-23build: astraceroute: Only build ioops with GeoIP support enabledTobias Klauser2-3/+2
The ioops module is only needed in geoip.o, thus make it dependent on CONFIG_GEOIP. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-07-23mausezahn: re-work configuration fileJon Schipp3-4/+4
/etc/netsniff-ng/mausezahn.conf as mentioned in manual was never read because code was statically set to mz.cfg in /etc/mausezahn. This patch simplifies things by using the existing /etc/netsniff-ng directory created in the default install and still using a single configuration but with a an easier to remember name e.g. ${tool}.conf. Example: $ cat /etc/netsniff-ng/mausezahn.conf user = testuser password = testpassword enable = awesome Pre-patch: $ mausezahn -x Mausezahn accepts incoming Telnet connections on port 25542. mz: Problems opening config file. Will use defaults Post-patch: $ mausezahn -x Mausezahn accepts incoming Telnet connections on port 25542. Signed-off-by: Jon Schipp <jonschipp@gmail.com> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2014-07-22astraceroute/Makefile: don't build ring_rx.oJon Schipp1-1/+0
Building astraceroute fails on EL systems because TPACKET_V3 is not available. Astraceroute functions properly without ring_rx.o. $ cat /etc/redhat-release CentOS release 6.4 (Final) Pre-patch: Building astraceroute: CC xmalloc.c CC ioops.c CC proto_none.c CC tprintf.c CC bpf.c CC str.c CC sig.c CC sock.c CC link.c CC ring_rx.c In file included from ring_rx.c:21: ring_rx.h:25: warning: ‘struct block_desc’ declared inside parameter list ring_rx.h: In function ‘user_may_pull_from_rx_block’: ring_rx.h:27: error: dereferencing pointer to incomplete type ring_rx.h: At top level: ring_rx.h:35: warning: ‘struct block_desc’ declared inside parameter list ring_rx.h: In function ‘kernel_may_pull_from_rx_block’: ring_rx.h:37: error: dereferencing pointer to incomplete type ring_rx.c: In function ‘destroy_rx_ring’: ring_rx.c:26: error: ‘TPACKET_V3’ undeclared (first use in this function) ring_rx.c:26: error: (Each undeclared identifier is reported only once ring_rx.c:26: error: for each function it appears in.) ring_rx.c: In function ‘setup_rx_ring_layout’: ring_rx.c:63: error: dereferencing pointer to incomplete type ring_rx.c:63: error: dereferencing pointer to incomplete type ring_rx.c:68: error: ‘struct ring’ has no member named ‘layout3’ ring_rx.c:69: error: ‘struct ring’ has no member named ‘layout3’ ring_rx.c:70: error: ‘struct ring’ has no member named ‘layout3’ ring_rx.c: In function ‘create_rx_ring’: ring_rx.c:83: error: ‘TPACKET_V3’ undeclared (first use in this function) ring_rx.c:87: error: ‘struct ring’ has no member named ‘layout3’ ring_rx.c: In function ‘alloc_rx_ring_frames’: ring_rx.c:118: error: ‘TPACKET_V3’ undeclared (first use in this function) ring_rx.c:121: error: ‘struct ring’ has no member named ‘layout3’ ring_rx.c:122: error: ‘struct ring’ has no member named ‘layout3’ ring_rx.c: In function ‘sock_rx_net_stats’: ring_rx.c:147: error: ‘TPACKET_V3’ undeclared (first use in this function) ring_rx.c:150: error: field ‘k3’ has incomplete type make: *** [astraceroute/ring_rx.o] Error 1 Post-patch: Building astraceroute: CC xmalloc.c CC ioops.c CC proto_none.c CC tprintf.c CC bpf.c CC str.c CC sig.c CC sock.c CC link.c CC ring.c CC dev.c CC astraceroute.c CC geoip.c LD astraceroute STRIP astraceroute Signed-off-by: Jon Schipp <jonschipp@gmail.com> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2014-07-22nacl_build.sh: use portable way of entering previous directoryJon Schipp1-1/+1
While writing a puppet manifest to provision netsniff-ng on a server. I encountered the following shell warnings: Notice: /Stage[main]/Netsniff_ng::Install/Exec[Install Netsniff-NG]/returns: Building NaCl for arch amd64 on host localhost (grab a coffee, this takes a while) ... Notice: /Stage[main]/Netsniff_ng::Install/Exec[Install Netsniff-NG]/returns: ./nacl_build.sh: line 41: cd: /root/netsniff-ng/curvetun: No such file or directory Notice: /Stage[main]/Netsniff_ng::Install/Exec[Install Netsniff-NG]/returns: NaCl lib path /root/nacl/nacl-20110221/build/localhost/lib/amd64 Notice: /Stage[main]/Netsniff_ng::Install/Exec[Install Netsniff-NG]/returns: NaCl include path /root/nacl/nacl-20110221/build/localhost/include/amd64 Notice: /Stage[main]/Netsniff_ng::Install/Exec[Install Netsniff-NG]/returns: ./nacl_build.sh: line 49: ./nacl_path.sh: No such file or directory They went away after I applied this patch. Signed-off-by: Jon Schipp <jonschipp@gmail.com> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2014-06-25xmalloc: Add and use xcallocTobias Klauser7-7/+24
Add a wrapper for calloc which checks for integer overflows in the calculation of the size to allocate. Use xcalloc to allocate an array of objects instead of calculating the size ourselves, which might cause an integer overflow. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-06-16netsniff-ng 0.5.9-rc2v0.5.9-rc2Tobias Klauser1-1/+1
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-06-16build: Fix formatting of mirror URLs in generated release announcementTobias Klauser1-3/+3
Get rid of unnecessary blank lines between the URLs. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-06-16dissector: Get rid of now unnecessary HAVE_DISSECTOR_PROTOSTobias Klauser9-59/+6
Since commit 1cc762a ("lookup: Move UDP/TCP port and Ethernet type lookup into own module") the netsniff-ng tool is the only one using the dissector infrastructure. Thus we no longer need to conditionally device HAVE_DISSECTOR_PROTOS, since netsniff-ng is the only tool defining this. While at it, also remove the __WITH_PROTOS macro which is checked in dissector_init_ethernet/dissector_cleanup_ethernet but is defined nowhere. This will cause the functions to be called from both the ethernet and ieee80211 dissectors, thus make sure we check the initialization state before freeing as well. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-06-16proto: Remove unnecessary include of hash.hTobias Klauser1-1/+0
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-06-16pkt_buff: Remove unnecessary void castTobias Klauser1-1/+1
lookup_hash() returns void * which does not need to be cast. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-06-13lookup: Move UDP/TCP port and Ethernet type lookup into own moduleTobias Klauser12-154/+182
Up to now, the lookup of TCP/UDP port names and Ethernet types was tightly integrated with the dissector infrastructure, since it is its main user. However, flowtop also makes use of the name lookup functionality without needing the actual dissector infrastructure. Thus, the basic dissector infrastructure also needs to be linked into flowtop without actually being used. Fix this by extracting the port/ethertype lookup into an own module which can then be used either directly (for flowtop) or as part of the dissector infrastructure (for netsniff-ng). This also reverts the quick & dirty fix introduced in commit f3322c6 ("flowtop: Include netlink dissector to fix build temporarily"). Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-06-13build: Mention the download mirrors in the release announcementTobias Klauser1-2/+4
Add mirror.distanz.ch and the source release on github to the download URLs in the release announcement. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-06-13flowtop: Include netlink dissector to fix build temporarilyTobias Klauser2-1/+4
flowtop links in the dissector modules just for the TC/UDP port lookup feature. Since dissector.h now includes libnl headers, we also need to include the libnl CFLAGS for flowtop build and thus also make it depend on libnl. The real fix for this in the future would be to extract the port lookup from dissector_eth.c and the just link in this module into flowtop instead of the entire dissector stuff. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-06-12netsniff-ng 0.5.9-rc1v0.5.9-rc1Tobias Klauser1-3/+3
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-06-04netsniff-ng: proto_nlmsg: Add notice about nlmsg pid fieldTobias Klauser1-1/+7
The port id field of the netlink message header does not necessarily indicate the PID of the receiving process [1] (e.g. in case of multithreaded applications or using multiple sockets). Mention this in a comment. [1] http://www.carisma.slowglass.com/~tgr/libnl/doc/core.html#core_netlink_fundamentals Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-06-04dissector: Restore paket type if capturing from nlmon deviceTobias Klauser2-11/+30
The kernel sets the skb pkttype to PACKET_OUTGOING for all packets being sent through dev_queue_xmit_nit(). However, if capturing packets from an nlmon device, this causes the information on whether the netlink packet was sent to kernel- or userspace (PACKET_KERNEL/PACKET_USER) to be overwritten. A previous attempt by Daniel Borkmann to fix this in kernel space [1] by not overwriting the packet type for netlink packets was not regarded as the proper solution. [1] http://patchwork.ozlabs.org/patch/338612/ Thus, attempt to fix this in userspace by looking at the pid field of the netlink packet, which is always 0 for messages to kernel space [2]. [2] http://www.carisma.slowglass.com/~tgr/libnl/doc/core.html#core_netlink_fundamentals Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-06-02mausezahn: Don't use ternary operator to decide which function to callTobias Klauser1-1/+5
Replace an odd use of the ternary operator with a more readable if/else. This fixes Debian Bug #750077. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-05-28netsniff-ng: Print process name of the netlink message originTobias Klauser1-0/+19
In the netlink message dissector, use the PID from the header to look up the process name of the sending process. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-05-28netsniff-ng: Add netlink dissectorTobias Klauser6-0/+133
Add an initial implementation of a dissector to work on netlink messages as received from an nlmon device. Use can use it as follows to monitor netlink traffic to/from the kernel: modprobe nlmon ip link add type nlmon ip link set nlmon0 up netsniff-ng -i nlmon0 ip link set nlmon 0 down ip link del dev nlmon0 rmmod nlmon Fixes: #89 Suggested-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-05-27build: Allow to build astraceroute and flowtop without GeoIP supportTobias Klauser4-11/+26
Both tools are already prepared to handle NULL return values of the geoip_* lookup functions, so we might as well build them without geoip support if not needed/present. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-05-27build: Remove unused CONFIG_LIBGEOIPTobias Klauser1-2/+0
If libgeoip is present, CONFIG_GEOIP will be set later on depending on HAVE_LIBGEOIP, we thus don't need to write CONFIG_LIBGEOIP to Config. This symbol isn't used anywhere in the build process. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-05-27geoip: Pass struct sockaddr_in{,6} as pointer instead of by valueTobias Klauser6-68/+68
Change the interface to the geoip_* functions to take a pointer to a struct sockaddr_in{,6} instead of the struct itself. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-05-27flowtop: Constify function parameter in walk_process()Tobias Klauser1-1/+1
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-05-23netsniff-nf: proto_ipv6: Remove unused #include "csum.h"Tobias Klauser1-1/+0
This module doesn't use the checksum functions, thus we don't need to include csum.h. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-05-12bpf: Zero out socket filter in bpf_parse_rules()Tobias Klauser2-7/+2
Instead of memsetting the struct sock_filter every time before we call bpf_parse_rules(), do it there directly. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-05-09ring: Merge common ring_{rx,tx} initialization into own functionTobias Klauser7-78/+39
Instead of having to perform the individual steps to initialize a ring and open coding them in multiple places, provide convenience functions to do all at once. This has the nice side effect of allowing to make most of these *_{rx,tx}_ring() functions static in their respective module. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-05-09netsniff-ng: Move function scope variablesTobias Klauser1-8/+9
Move some variables from the function scipe to the block where they're used solely. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-05-09trafgen: Remove unnecessary initialization of ct.reserve_sizeTobias Klauser1-1/+0
It will be set later on depending on command line option (or panic() out) and it is initialized to 0 by a memset() before anyways. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-05-09netsniff-ng: Remove unnecessary memset of struct pollfdTobias Klauser1-2/+0
rx_poll will be passed to prepare_polling() which already zeros the struct, so no need to do it before. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-05-09netsniff-ng: Remove unnecessary initialization of struct ctx membersTobias Klauser1-4/+0
These will be set later on depending on command line option (or panic() out) and they're set to 0 by init_ctx() anyways. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-05-03doc: Fix typos in mausezahn and trafgen manpagesKartik Mistry2-2/+2
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-05-03all: Use macros for printf/scanf format specifiersJames McCoy9-55/+62
Any types that are fixed width should use the standard format specifier macros (PRI... for printf-type functions, SCN... for scanf-type functions) to ensure proper data access. Prior to this ifpps was crashing in 32-bit environments due to the following call mvwprintw(screen, (*voff)++, 2, "%s,%s %s (%s%s), t=%lums, cpus=%u%s/%u" " ", uts.release, machine, ifname, drvinf.driver, buff, ms_interval, top_cpus, top_cpus > 0 && top_cpus < cpus ? "+1" : "", cpus); since ms_interval is a uint64_t but %lu expects an unsigned long, which is only 32 bits. Signed-off-by: James McCoy <vega.james@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-04-30build: Do not add PREFIX to ETCDIRKartik Mistry1-1/+1
This will fix issue of installation of configuration files to /usr/local/etc (or /usr/etc for distribution builds) instead of /etc. [tklauser: extended description a bit] Signed-off-by: Kartik Mistry <kartik.mistry@gmail.com>
2014-04-30netsniff-ng/ring: Make verbose flag boolTobias Klauser5-7/+7
Change type of verbose flag from int to bool. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>