summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-02-01mausezahn: use getopt_long instead of getoptHEADmasterZahari Doychev1-7/+6
The musl getopt stops processing the options at the first non-option argument comapared to the glibc variant. Using getopt_long fixes this problem. Signed-off-by: Zahari Doychev <zahari.doychev@linux.com>
2022-04-22trafgen: Check pointer in ipv6 device address lookup functionMatPerin1-0/+2
The getifaddrs function returns a linked list node for L2 even in the case of L3 interfaces (e.g. a TUN device), but with the pointer to the address structure set to NULL. This causes a segfault when trying to access the address family from it when such network interfaces are present in the system. The issue is solved by checking the validity of the pointer beforehand: if the address structure is present the address family can be fetched and the current iteration can go on safely, otherwise the node is skipped (as it is not linked to any address). Signed-off-by: Matteo Perin <matteoperin1302@gmail.com>
2022-02-18netsniff-ng: dump stats on stderr when fdo is stdoutClément Péron1-4/+9
When the output of netsniff-ng is configured as stdout, there is no more stats outputed. Let's output them on stderr. Signed-off-by: Clément Péron <peron.clem@gmail.com>
2022-02-18Cmds: automatically create folderClément Péron1-1/+2
When installing netsniff-ng, the make install complain when the folder are not present. Let's create them for the user. Signed-off-by: Clément Péron <peron.clem@gmail.com>
2021-12-09trafgen: Fix documentation for seqinc and seqdecSean Anderson1-2/+2
These functions take the "times" argument as the second parameter, not the third. Fixes: 00e83a5 ("man: trafgen: finish syntax section") Signed-off-by: Sean Anderson <sean.anderson@seco.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2021-09-02ci: install libsodium in build testsTobias Klauser1-1/+1
This allows to test the curvetun build. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2021-09-02trafgen.8: fix typo in example packetBaruch Siach1-1/+1
First MAC address is destination, but the second is source. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2021-09-02Detect libpcap dependencies using pkg-configBaruch Siach2-2/+4
When building statically the link command line must include all dependencies of all libraries. libpcap can optionally depend on libnl. mausezahn can't build statically in this case. Use pkg-config in configure and in the link command to construct the library flags we need to link with libpcap. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2021-04-06trafgen: allow to use a range of CPUs starting from any CPUIvan Koveshnikov2-28/+58
Signed-off-by: Ivan Koveshnikov <ivan.koveshnikov@gcorelabs.com>
2021-04-06trafgen: allow to set packet rate in kpps and MppsIvan Koveshnikov2-2/+8
Signed-off-by: Ivan Koveshnikov <ivan.koveshnikov@gcorelabs.com>
2021-03-29Remove mentions of Travis CI in docs and configTobias Klauser3-10/+1
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2021-03-29Remove Travis CI integrationTobias Klauser1-37/+0
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2021-03-29Add GitHub action for build testingTobias Klauser1-0/+53
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2021-01-11netsniff-ng v0.6.8v0.6.8Tobias Klauser1-2/+2
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-10-19astraceroute: make some panic() messages more verboseuno200011-5/+5
Signed-off-by: uno20001 <regisztralo111@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-10-19astraceroute: change type of variables from int to bool in struct ctxuno200011-23/+23
Signed-off-by: uno20001 <regisztralo111@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-10-02all: change bug report instructions in copyright messageTobias Klauser8-8/+14
The bugs@netsniff-ng.org e-mail bounces. Also it's more convenient to report bugs using GitHub rather than via e-mail, so consistently mention https://github.com/netsniff-ng/netsniff-ng/issues for where to report bugs. Fixes #226 Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-08-19mausezahn: move variable definitions from mz.h to mausezahn.cTobias Klauser2-23/+74
Move variable definitions to avoid "multiple definition of symbol" linker errors with gcc-10. Fixes #216 Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-08-19mausezahn: move variable definitions from llist.h to llist.cTobias Klauser2-2/+4
Move variable definitions to avoid "multiple definition of symbol" linker errors with gcc-10. Updates #216 Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-08-19mausezahn: move variable definitions from mops.h to mops.cTobias Klauser2-5/+8
Move variable definitions to avoid "multiple definition of symbol" linker errors with gcc-10. Updates #216 Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-08-19mausezahn: move variable definitions cli.h to cli.cTobias Klauser2-10/+23
Move variable definitions to avoid "multiple definition of symbol" linker errors with gcc-10. Updates #216 Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-08-19mausezahn: make needlessly global variables staticTobias Klauser4-28/+22
Move variables only used withing a single compilation unit from mz.h and make them static. This avoids "multiple definition of symbol" linker errors with gcc-10. Updates #216 Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-08-14AUTHORS: updateTobias Klauser1-0/+1
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-08-14cookie: add sys/types headerRosen Penev1-0/+1
Needed for ssize_t under uClibc-ng.
2020-06-19trafgen: remove write-only variable pktTobias Klauser1-3/+1
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-06-19astraceroute.8: use more sensitive terminologyTobias Klauser1-4/+4
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-06-15mausezahn: remove unused MZ_SIZE_LONG_INTTobias Klauser2-5/+0
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-05-04netsniff-ng v0.6.7v0.6.7Tobias Klauser1-2/+2
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-05-04AUTHORS: updateTobias Klauser1-0/+1
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-05-04proto_lldp: prevent accidental out of bounds memory accessNathaniel Ferguson1-1/+5
Added an integer arithmetic check prior to performing arithmetic to prevent accidental out of bounds memory access. Signed-off-by: Nathaniel Ferguson <nathaniel@leapfrog.foundation> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-05-04proto_lldp: fix pointer increment in LLDP_TLV_SYSTEM_CAP caseNathaniel Ferguson1-1/+1
Fixed a typo wherein a pointer was incremented by sizeof(uint32_t) after reading sizeof(uint16_t) and before reading another sizeof(uint16_t). In essence a potential out of bounds memory access (read) due to improper increment of pointer Signed-off-by: Nathaniel Ferguson <nathaniel@leapfrog.foundation> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-05-04proto_lldp: Check inet_ntop() return valuesNathaniel Ferguson1-3/+11
Make netsniff error out of a recv routine if calls to inet_ntop() fail by adding return value checks. There are other inet_ntop() usages of similar however these are in a receive code path with user data for most of the variables Signed-off-by: Nathaniel Ferguson <nathaniel@leapfrog.foundation> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-05-04proto_ipv4: Make netsniff detect and properly handle some malformed packetsNathaniel Ferguson1-1/+1
Entails the potential integer underflow of a signed integer. Signed-off-by: Nathaniel Ferguson <nathaniel@leapfrog.foundation> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-02-21mz: Zero memory allocated for new automops elementMichael R Torres1-1/+1
Prevent crashes when using mausezahn in interactive mode by using calloc to zero the memory upon allocation. Fixes #195 Signed-off-by: Michael R Torres <mic.ric.tor@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-02-21AUTHORS: updateTobias Klauser2-0/+2
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-02-20mz: Fix accidental assignment in conditional statementMichael R. Torres1-2/+2
Corrects the accidental assignment of _c_ to 'c' or 'p' due to a missing equals sign. This enables the proper display of the missing argument error message for all relevant options. Signed-off-by: Michael R Torres <mic.ric.tor@gmail.com>
2020-02-01AUTHORS: updateTobias Klauser1-0/+1
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-02-01ifpps: fix iface stat parsing if uppercaseBenoît Ganne1-1/+1
Linux netdev can contain uppercase characters. Signed-off-by: Benoît Ganne <benoit.ganne@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2019-10-04mausezahn: Support -R to set packet priorityPetr Machata4-1/+33
Add a command line option -R to specify SO_PRIORITY socket option. This then sets priority of the generated SKBs, which is handy for testing Qdiscs and other priority-dependent functionality. Signed-off-by: Petr Machata <petrm@mellanox.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2019-10-04mausezahn.8: Document -rPetr Machata1-0/+3
This option is mentioned further in the man page, but is omitted in the main section. Add it. Signed-off-by: Petr Machata <petrm@mellanox.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2019-10-02astraceroute: reorder function declarationsuno200011-4/+4
Group functions for the same protocol together. Signed-off-by: uno20001 <regisztralo111@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2019-09-23AUTHORS: updateTobias Klauser1-0/+1
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2019-09-23trafgen: reset errno before calling sscanf in str2macJoachim Nilsson1-0/+1
When testing trafgen with the following example from the man page the error message "Failed to parse MAC address 11:22:33:44:55:66" is printed. trafgen -o lo --cpus 1 -n 3 '{ eth(da=11:22:33:44:55:66, da[0]=dinc()), tcp() }' Turns out errno was not cleared before str2mac() called sscanf(). Signed-off-by: Joachim Nilsson <troglobit@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2019-05-09netsniff-ng v0.6.6v0.6.6Tobias Klauser1-2/+2
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2019-05-03AUTHORS: regenerate and correct Jon's nameTobias Klauser2-2/+3
Jon's name was spelled wrong in .mailmap in commit 79608cdc169b ("AUTHORS: auto-generate from commit log") and thus ended up being wrong in the AUTHORS file since we started auto-generating it. Sorry about that! Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2019-04-10trafgen: fix -t 0 option to use sendtoQuentin Chateau1-5/+0
Currently, using -t 0 option calls shaper_set_delay with 0 sec and 0 ns, which results in sh->type to be SHAPER_NONE. This in turn causes trafgen to use TX_RING. Expected behavior, from "man trafgen": If this option is given, then instead of packet(7)'s TX_RING interface, trafgen will use sendto(2) I/O for network packets, even if the argument is 0. This patch forces sh->type to be set to SHAPER_DELAY even if the delay is 0. shaper_delay already handles the case where sh->type is SHAPER_DELAY and the delay is 0. Fixes #208 Signed-off-by: Quentin Chateau <quentin.chateau@gmail.com> [tklauser: adjusted commit message to include change description] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2019-03-06AUTHORS: updateTobias Klauser2-0/+3
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2019-03-06Build system: Use GZIP_ENV instead of GZIPDaniel Roggow2-2/+2
Older versions of gzip assume the GZIP environment variable contains flags[1]. Building netsniff-ng on a system with such a version of gzip will yield the following error: INST netsniff-ng/netsniff-ng gzip -9 -c netsniff-ng.8 > netsniff-ng/netsniff-ng.8.gz gzip: gzip: No such file or directory A practical alternative to redefining GZIP in the Makefile seems to be to use the GZIP_ENV make variable[2] instead. [1] The GZIP environment variable was deprecated in gzip version 1.7. See https://www.gnu.org/software/gzip/manual/html_node/Environment.html and https://git.savannah.gnu.org/cgit/gzip.git/tree/NEWS for more information. [2] https://www.gnu.org/software/automake/manual/automake.html#index-GZIP_005fENV Signed-off-by: Daniel Roggow <daniel.roggow@rockwellcollins.com>
2018-12-11AUTHORS: update authorsTobias Klauser1-0/+1
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2018-12-11astraceroute: checksum calculation for ICMP and TCPuno200011-44/+106
Calculate ICMP and TCP checksums for both IPv4 and IPv6, Fixes #198 Fixes #200 Signed-off-by: uno20001 <regisztralo111@gmail.com> [tk: code formatting, C89 compatibility] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>