aboutsummaryrefslogtreecommitdiff
path: root/testprogs
Commit message (Collapse)AuthorAgeFilesLines
* findalldevstest: Print also Address Family numericallyFrancois-Xavier Le Bail2023-05-271-2/+2
|
* findalldevstest: Avoid warning/error when IPv6 is not enableFrancois-Xavier Le Bail2023-05-231-0/+2
| | | | | | | | The warning/error was: ./findalldevstest.c:193:8: error: unused variable 'ipv6_buf' [-Werror,-Wunused-variable] char ipv6_buf[INET6_ADDRSTRLEN]; ^
* Fix spaces before tabs in indentationFrancois-Xavier Le Bail2023-02-151-1/+1
|
* testprogs/.gitignore: Add a missing fileFrancois-Xavier Le Bail2022-11-261-0/+1
| | | | [skip ci]
* fuzz: Disable fuzz targets for WindowsAlexey Vishnyakov2022-10-201-1/+5
|
* fuzz: Generate unique temporary file names to enable parallel fuzzingAlexey Vishnyakov2022-10-192-6/+31
|
* Merge pull request #1113 from fenner/no-eventfdGuy Harris2022-08-252-0/+192
|\ | | | | Close the eventfd if we are non-blocking
| * Close the eventfd if we are non-blockingBill Fenner2022-08-252-0/+192
| | | | | | | | | | | | | | The eventfd is used to break out of a poll() before it times out, used by pcap_breakloop(). If we are non-blocking, then the eventfd is never needed, so we close it. (And open a new eventfd if we switch to blocking).
* | Fix some typosFrancois-Xavier Le Bail2022-07-042-2/+2
| | | | | | | | [skip ci]
* | Remove trailing space/tabFrancois-Xavier Le Bail2022-07-031-1/+1
| | | | | | | | [skip ci]
* | Convert visopts.py to Python 3. [skip ci]Denis Ovsienko2022-06-021-29/+40
|/ | | | | | | | | | In Python 3 "print" is a function, not a keyword; rearrange some imports clauses; redo the BPF expression escaping; for clarity use the full syntax within the string template; fix and improve the dot subprocess management; use modern HTTP server props. This revision has been tested to work with Python 3.8, it should work with earlier Python 3 versions as well.
* Lose an unused var in testprogs/filtertest.c. [skip ci]Denis Ovsienko2022-05-201-4/+1
|
* Lose unused testprogs/pcap_compile_test.c [skip ci]Denis Ovsienko2022-05-201-11/+0
| | | | The code snippet in that file is a subset of testprogs/filtertest.c.
* configure: get rid of unused substituted variable.Guy Harris2022-04-041-4/+3
| | | | | We haven't set EXTRA_NETWORK_LIBS in a while; no reason to keep using it.
* testprogs: line-wrap Makefile.in to 80 characters. [skip ci]Guy Harris2022-04-041-11/+26
|
* Revert "findalldevstest: temporary test to see if this squelches Valgrind ↵Guy Harris2022-01-191-5/+0
| | | | | | | | | | | | | | warnings." This reverts commit 778f2c0e806090dc524627161bca826cc1d061a2. Yes, Illumos (and probably Solaris) may fflush() all the standard I/O streams before exiting, but it doesn't fclose() them, so stuff might not be freed before exiting (but it should be accessible from stdin, stdout, or stderr, so it's at worst a "still reachable" issue - what gives?). There *appears* to be a suppressor for that in the Solaris valgrind, but it doesn't seem to be working.
* findalldevstest: temporary test to see if this squelches Valgrind warnings.Guy Harris2022-01-191-0/+5
|
* CMake: Build valgrindtest only if Autoconf would. [skip ci]Denis Ovsienko2021-07-311-1/+4
| | | | | In partucular, MATRIX_CMAKE=yes subset on Solaris 10 always failed trying to compile valgrindtest.c without <net/bpf.h>.
* Use snprintf() in findalldevstest.c.Denis Ovsienko2021-05-231-2/+2
| | | | | | | | | | | | | | | Clang 10.0.1 in OpenBSD 6.9 (on MIPS64, although not on AArch64 or AMD64) emitted a few warnings, which on this occasion did not stand for an issue. Squelch these anyway by switching to snprintf(). While at it, clarify the array size using a sizeof(). /usr/bin/ld: Dwarf Error: found dwarf version '0', this reader only handles version 2 information. /tmp/findalldevstest-807330.o: In function `main': findalldevstest.c:(.text+0x6ec): warning: sprintf() is often misused, please use snprintf()
* Define timeradd() and timersub() if necessary.Denis Ovsienko2021-03-311-3/+0
| | | | | | | testprogs/findalldevstest-perf uses timeradd() and timersub(), which are available as macros in Solaris 11 via <sys/time.h> (same as in Linux, for example), but not in earlier versions. Add the conditional definitions to fix "make testprogs" on Solaris 10.
* Revert "Don't wrap chunks of headers with extern "C" { ... }."Guy Harris2021-03-171-2/+2
| | | | | | | This reverts commit 8b6b13d4cbb685db047af04c49817ed81fff7c35. That solution allowed you to intermix declarations/definitions and before the extern "C", so you can see what's being imported.
* Don't wrap chunks of headers with extern "C" { ... }.Guy Harris2021-03-171-2/+2
| | | | | | | | | | | Instead, explictly flag individual functions with extern "C" by adding it to the tag we're already using for exported functions, and creating a new tag to use for non-exported functions. Rename those tags, and the tags used for exported data, to say what they do, rather than saying "this is an API" (we may export things we don't want to be treated as part of the API, but that we have to export because some programs use them).
* make some compilers be quiet about un-initialized variable, as per #982Michael Richardson2020-12-291-1/+1
|
* Fix some typosFrancois-Xavier Le Bail2020-12-122-2/+2
| | | | [skip ci]
* Fix some spelling. [skip ci]Denis Ovsienko2020-10-091-1/+1
|
* Merge pull request #800 from catenacyber/fuzzrMichael Richardson2020-08-283-0/+135
|\ | | | | Fuzz rpcap
| * Fuzz rpcpap protocolPhilippe Antoine2020-07-203-0/+135
| |
* | Make minor improvements to visopts.py.Denis Ovsienko2020-08-201-11/+18
|/ | | | | | | When dot fails to start, print a user-friendly error message instead of dumping the stack trace. Fixup some wording here and there. [skip ci]
* writealldevstest: add support for -D and opening by number.Guy Harris2020-07-031-25/+199
| | | | | | A bit more convenient on Windows. Make the error reporting a bit more like tcpdump while we're at it.
* Initialize snaplen.Guy Harris2020-07-031-1/+1
| | | | | That shouldn't be necessary, but it avoids compiler warnings with older versions of Visual Studio.
* Add support for setting the snapshot length and not setting the filter.Guy Harris2020-07-031-14/+36
| | | | | | | | | | | Add a -s option to set the snapshot length; don't set it, even to a default value, if -s isn't specified. If there are no arguments specifying a filter, don't compile or install a filter. This allows us to test 1) whether the snapshot length works even if no filter is set and 2) what happens if the snapshot length isn't set.
* Remove some trailing tabsFrancois-Xavier Le Bail2020-06-171-1/+1
| | | | | | Moreover: Remove some spaces before tabs. Remove an extra blank line.
* threadsignaltest: add an option to disable the wakeup.Guy Harris2020-06-021-19/+35
| | | | | | | On some devices on some platforms with newer versions of libpcap, pcap_breakloop() attempts to wake up any process blocked in a read on the same pcap_t. Suppressing the additional wakeup attempt lets that be tested.
* Fix a typoFrancois-Xavier Le Bail2020-05-191-1/+1
|
* testprogs/Makefile.in: Sort the source files alphabeticallyFrancois-Xavier Le Bail2020-05-191-2/+2
|
* Initialize a variable.Guy Harris2020-05-071-1/+1
| | | | | If no -w flag is supplied, it's not set by the argument parsing code, so we need to initialize it to null first.
* Support AirPcap devices with a pcap module.Guy Harris2020-05-074-1/+367
| | | | | | | | This allows us to update the support for newer APIs in the future - and in the present, with pcap_set_datalink() - and would allow Npcap to remove its AirPcap support. Add another test program, while we're at it.
* Fix earlier commit.Guy Harris2020-04-131-2/+2
|
* Add an ENABLE_PROFILING option.Guy Harris2020-04-131-3/+3
| | | | | It may require tweaking for UN*Xes, but it should suffice for Visual Studio on Windows.
* Fix Windows compilation.Guy Harris2020-04-101-2/+2
|
* Add a new program for performance testing of pcap_findalldevs().Guy Harris2020-04-104-0/+106
|
* Fix "make depend" for out-of-tree builds.Guy Harris2020-03-021-1/+1
| | | | | | | | Have mkdep take a -s argument, giving the source directory, and have it prepend that directory to all source files before running them through the compiler's make-dependencies operation. (There's more to fix, namely handling generated source files.)
* Correctly look for mkdep in the top-level source directory.Guy Harris2020-03-021-1/+2
| | | | | | The right way is to look in top_srcdir, rather than assuming it's in .. for makefiles in subdirectories; that assumption doesn't work for out-of-tree builds.
* Plug memory-leakGisle Vanem2020-02-251-1/+2
| | | If the '-i' option is not used, the strdup() memory was not freed.
* sa_mask is a sigset_t, which is not guaranteed to be an int.Guy Harris2020-02-031-1/+1
|
* Only define local flag variables for UN*X-only options on UN*X.Guy Harris2020-02-031-0/+2
|
* On UN*X, add options to test signals during a capture.Guy Harris2020-02-031-2/+77
|
* On Linux, return error on interface going away, not just going down.Guy Harris2020-01-291-28/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a pain to detect, because the PF_PACKET socket code appears to get separate "interface went down" and "interface went away" notifications in my "unplug a USB Wi-Fi adapter" tests on my VMware Fusion Ubuntu 18.04 virtual machine (5.3.0 kernel), and the first notification delivers a wakeup and returns ENETDOWN while the second notificaiton delivers *no* wakeup and sets the ifindex member of the struct packet_sock for the socket, so there's nothing we can test after the wakeup that's guaranteed to indicate that the interface has disappeared. So what we have to do is remember the ENETDOWN but not return it as an error, and then arrange to periodically check whether the interface is still there; if it isn't, we *then* return the "interface went away" error, and, if we see traffic or see that the interface is up, we clear the remembered ENETDOWN and stop doing the periodic checks. This is tricky, because it needs to work not only for blocking pcap_t's, where we're in a loop doing poll() calls, so we can keep checking within the loop, but also for non-blocking pcap_t's on which the caller is doing select()/poll()/epoll_wait(). In order to make *that* work, we need to tweak the semantics of pcap_get_required_select_timeout() so that it's not guaranteed that it will always return the same value, so that it should be called within event loops rather than called once outside the event loop. Normally, there is no timeout required for Linux PF_PACKET sockets, but when we're doing the periodic tests, the timeout is required. While we're doing that, we make the return value of pcap_get_required_select_timeout() a const pointer - there was no good reason for the caller to modify it (it doesn't belong to the caller). If poll() returns POLLERR, use getsockopt(SO_ERROR) to get the socket error, rather than a read(). Update the documentation to reflect this, and make various other cleanups (including documenting the error return value for pcap_get_selectable_fd() to -1 rather than PCAP_ERROR - it's not an error code, it's just a specific error value). Also note that, for kqueues on *BSD/macOS and for select/poll on Linux, the timeout needn't be used as a timeout for the call - you can have a timer, so that when that *particular* timer fires, you try calling pcap_dispatch() on the pcap_t to which it corresponds. Update selpolltest to add more capabilities needed when testing this on Linux. This should address GitHub issue #859 and pull request #858.
* Use more HTTPS in URLsFrancois-Xavier Le Bail2020-01-191-4/+4
| | | | [skip ci]
* Use correct function name in outputting error information.Nan Xiao2019-11-153-3/+3
|