aboutsummaryrefslogtreecommitdiff
path: root/bpf_image.c
Commit message (Collapse)AuthorAgeFilesLines
* Make some static variables thread-local.Guy Harris2023-05-051-1/+3
| | | | | | | | This should make some functions thread-safe, even if it doesn't make them fully-reentrant; at least some of them would requiree API changes to full reentrancy. This should fix #1174.
* Squelch some annoying warnings.Guy Harris2019-10-141-0/+8
|
* Show special magic Linux absolute load addresses symbolically.Guy Harris2019-10-141-3/+87
| | | | Address GitHub issue #861.
* Remove some workarounds for old compilers.Guy Harris2019-08-091-32/+32
| | | | | | | | | | | | | Require Visual Studio 2015 or later; fail if we don't have it, and remove checks for older versions. That means we have C99-compliant snprintf() and vsnprintf(); require them when configuring for UN*X, and then use them directly, rather than having wrappers for systems lacking them. If we're using MSVC, skip the tests for options to request C99 compatibility - either we have VS 2015, which is sufficient, or we don't, in which case we fail.
* Squelch warnings due to empty format strings.Guy Harris2018-05-061-50/+81
| | | | | | Have a buffer for the non-constant-string operands and a pointer to the operand string; set it to point to a constant string in cases where the operand isn't generated from a value in the instruction.
* Squelch non-constant format warnings.Guy Harris2018-05-061-55/+50
| | | | | For each opcode case, directly generate the operand string, rather than setting a format string pointer and value and generating it later.
* Don't use old-style function definitions.Guy Harris2018-03-201-3/+1
|
* Get rid of pcap-stdinc.h.Guy Harris2017-09-051-3/+0
| | | | | On Windows, in each file, include whatever that particular file needs, just as we do on UN*X and MS-DOS.
* Put the stuff to get the sized integer types defined into pcap-types.h.Guy Harris2017-09-041-10/+1
| | | | | | | | | Have pcap-types.h arrange to define the intN_t/u_intN_t types, and the INTn_MAX/UINTn_MAX values, on all platforms, and use it wherever it's appropriate. Include it up front in scanner.l, to avoid redefinitions of the INTn_MAX/UINTn_MAX types.
* Always include <config.h> rather than "config.h".Guy Harris2017-08-181-1/+1
| | | | | | | | This can prevent bizarre failures if, for example, you've done a configuration in the top-level source directory, leaving behind one config.h file, and then do an out-of-tree build in another directory, with different configuration options. This way, we always pick up the same config.h, in the build directory.
* Use pcap_snprintf() instead of snprintf().Guy Harris2015-11-031-3/+3
| | | | | | | | | | | On UN*Xes with snprintf(), we just #define pcap_snprintf to snprintf. On UN*Xes without snprintf(), we provide our own, but call it pcap_snprintf(). On Windows, we have a routine that wraps _snprintf(), with C99 semantics (ensuring null termination if the string won't fit), called pcap_snprintf(), and use that.
* The official #define for 32-bit and 64-bit Windows is _WIN32.Guy Harris2015-08-311-3/+3
| | | | | | | | | | | | | It's _WIN32, with a leading underscore, not WIN32. See, for example: https://sourceforge.net/p/predef/wiki/OperatingSystems/ and https://msdn.microsoft.com/en-us/library/b0084kay.aspx *Some* environments may also define WIN32, but we shouldn't depend on that.
* Support mod and XOR operators.Guy Harris2014-05-181-0/+20
| | | | | | | | | | Same opcodes as on Linux. We support them in BPF filters, but warn, in the man page, that using them on anything other than Linux 3.7 or later will cause the filter to run in userland and thus require more resources and perhaps cause more packets to be dropped. (The filter will presumably be rejected by the kernel-mode code if it doesn't support BPF_MOD or BPF_XOR, and libpcap will fall back on running the filter in userland.)
* remove libpcap's own CVS keywordsDenis Ovsienko2014-01-031-5/+0
| | | | | | This change removes CVS keywords that express that the file belongs to libpcap repository. All such keywords represented the revision and timestamp by the end of 2008 or even older.
* Squelch format vs. argument warnings from clang.Guy Harris2012-11-301-6/+9
|
* Include headers that should cause u_int64_t to be defined.Guy Harris2010-01-271-0/+14
|
* Make some arguments const pointers if that makes sense.guy2008-01-021-2/+2
| | | | | | | | | | | | | | | | | | | Add some additional checks to bpf_validate(), from OpenBSD. Use bpf_validate() in install_bpf_program(), so we validate programs even when they're being processed by userland filters; we make bpf_validate() not reject backward branches, as we use them for the protochain operator. For BPF, don't assume that, just because no_optimize was set, we have a program that we can't hand to the kernel; the user of the application might have specified no optimization (e.g., tcpdump with -O), or we might have generated code to handle 802.11 headers (the optimizer can't handle that code). Instead, try handing the filter to the kernel and, if that fails, try it in userland. Get rid of BPF_MAXINSNS - we don't have a limit on program size in libpcap.
* Pick up changes from NetBSD:guy2007-06-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | several files: date: 2006/02/27 15:53:24; author: drochner; state: Exp; avoid shadowing globals, for WARNS=2 date: 2006/02/27 15:55:30; author: drochner; state: Exp; minor constification, good for WARNS=3 now date: 2006/02/27 15:57:17; author: drochner; state: Exp; NetBSD adaption: ... -const pcap_strerror() for consistency gencode.c: date: 2006/04/26 09:24:33; author: tron; state: Exp; Add missing "const" keywords to match declarations in "pcap.h". date: 2006/10/15 19:27:21; author: christos; state: Exp; add a volatile variable to prevent vfork/longjmp clobbering. optimize.c: date: 2006/05/17 17:48:36; author: drochner; state: Exp; Make the optimizer use unsigned numbers as the kernel does. While it is not agreed on that purely unsigned arithmetics is nice, different behaviour of optimized and unoptimized code is less desirable. pcap-bpf.c: date: 2006/02/27 15:51:38; author: drochner; state: Exp; pull in from NetBSD's libpcap: use cloning bpf device on NetBSD Have the configure script check for paths.h, so that we can include it only if we have it, and use the cloning BPF device only if we're on NetBSD *and* _PATH_BPF is defined (hopefully this will keep us from using it on versions of NetBSD that don't have a cloning BPF device; if, in the future, other OSes with BPF get cloning BPF devices, we can make this work for them as well).
* Add _U_ to "rcsid[]" definitions, to eliminate "unused variable"guy2003-11-151-2/+2
| | | | warnings from newer versions of GCC.
* <pcap.h> includes <sys/types.h> and <sys/time.h>; there's no need toguy2002-03-241-4/+1
| | | | | include it in these files, as they either include "pcap-int.h", which includes <pcap.h>, or they include <pcap.h> directly.
* add config.h, remove gnuc.h. remove __deadassar2000-07-111-2/+5
|
* do not use sprintf(). always use snprintf().itojun2000-04-271-3/+3
| | | | | | from NetBSD/OpenBSD src/lib/libpcap. use freeifaddrs() if exists.
* Initial revisionmcr1999-10-071-0/+288