summaryrefslogtreecommitdiff
path: root/print-pflog.c
Commit message (Collapse)AuthorAgeFilesLines
* Rename the BSD_AFNUM_ values to BSD_AF_.Guy Harris2023-02-201-4/+4
| | | | | | They correspond to OS socket API AF_ values, which are distinct from address family numbers in the IANA registry at https://www.iana.org/assignments/address-family-numbers/address-family-numbers.xhtml
* pflog: use BSD socket AF numbers, not RFC 1700 AF numbers.Guy Harris2022-01-301-1/+1
|
* Fix names for action values.Guy Harris2022-01-301-3/+3
|
* Handle DLT_PFLOG on all OSes.Guy Harris2022-01-291-43/+62
| | | | | | | | | | | | | | | | | | | Don't pad the pflog header with BPF_WORDALIGN(); round up to a multiple of 4, instead, as that's what all but FreeBSD do, and FreeBSD used to do that and should go back to doing so (kern/261566). Don't rely on the OS's pflog include files to define direction types, reason types, action types, or the layout of the header; instead, define them ourselves in a header of our own, with #ifs to select the ones that are only on some platforms. That way, it'll handle some fields and field values (the ones common to all OSes with pflog) on all OSes, even ones without pflog. That also expands the set of direction, reason, and action codes to what various *BSDs and Darwin support. Also, handle all the different AF_INET6 values in various *BSDs and Darwin.
* PFLOG: Use nd_printjnp instead of %s conversion specifierFrancois-Xavier Le Bail2020-12-141-3/+4
|
* PFLOG: Try to fix previous commitFrancois-Xavier Le Bail2020-12-141-1/+1
| | | | | | | | | | | | | The error was: ./print-pflog.c:99:20: error: passing 'char const[16]' to parameter of type 'const u_char *' (aka 'const unsigned char *') converts between pointers to integer types with different sign [-Werror,-Wpointer-sign] nd_printjnp(ndo, hdr->ruleset, PFLOG_RULESET_NAME_SIZE); ^~~~~~~~~~~~ ./netdissect.h:397:61: note: passing argument to parameter here extern void nd_printjnp(netdissect_options *, const u_char *, u_int); ^
* PFLOG: Use nd_printjnp() instead of %s conversion specifierFrancois-Xavier Le Bail2020-12-141-2/+5
| | | | This change add a bounds checks.
* Remove useless 'return' at end of void functions (style)Francois-Xavier Le Bail2020-09-281-1/+0
|
* PFLOG: Update the link-layer dissector to a void functionFrancois-Xavier Le Bail2020-08-061-8/+13
| | | | | | Moreover: Use GET_U_1() when needed. Remove trailing "_if" from the protocol name.
* Use the new GET_ macros instead of the EXTRACT_ onesFrancois-Xavier Le Bail2019-03-261-6/+6
| | | | | | | The exceptions are currently: Some EXTRACT_ in print-juniper.c, not used on packet buffer pointer. An EXTRACT_BE_U_3 in addrtoname.c, not always used on packet buffer pointer.
* Print truncations with nd_print_trunc() instead of tstr[] stringsFrancois-Xavier Le Bail2018-05-041-4/+3
| | | | | | | | Remove the tstr[] strings. Update the output of some tests accordingly. Moreover: Add or update some ndo_protocol fields.
* Remove useless commentsFrancois-Xavier Le Bail2018-03-191-7/+0
|
* Add the ndo_protocol field in the netdissect_options structureFrancois-Xavier Le Bail2018-03-161-0/+2
| | | | | Update this field in printer entry functions. It will be used for some printings.
* Always include <config.h> rather than "config.h".Guy Harris2018-01-211-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 quoted include netdissect-stdinc.h instead of angle-bracketed oneFrancois-Xavier Le Bail2018-01-211-1/+1
|
* Update ND_PRINT() as a variadic macroFrancois-Xavier Le Bail2018-01-071-8/+8
|
* Use ND_TTEST_SIZE()/ND_TCHECK_SIZE() macros (1/n)Francois-Xavier Le Bail2018-01-031-1/+1
|
* Add EXTRACT_ calls.Guy Harris2017-12-301-4/+4
|
* Remove all storage class specifier 'register'Francois-Xavier Le Bail2017-12-131-1/+1
| | | | | | Let the compiler do the optimizations (or not) based on build options. Avoid 'value has been optimized out' messages in gdb using '-O0'.
* Rename EXTRACT_ macrosFrancois-Xavier Le Bail2017-11-221-2/+2
| | | | | | | | | | | | | | | | Now all the macros have a name meaning a count in bytes. With _S_: signed, _U_: unsigned e.g.: EXTRACT_BE_32BITS -> EXTRACT_BE_U_4 EXTRACT_LE_32BITS -> EXTRACT_LE_U_4 ... EXTRACT_BE_INT32 -> EXTRACT_BE_S_4 and have: EXTRACT_8BITS -> EXTRACT_U_1 EXTRACT_INT8 -> EXTRACT_S_1
* Rename EXTRACT_nBITS() macros to EXTRACT_BE_nBITS()Francois-Xavier Le Bail2017-11-181-2/+2
| | | | | It indicates clearly that these macros are used to extract big-endian integral values.
* Move the printer summaries from INSTALL.txt to each printerFrancois-Xavier Le Bail2016-08-141-0/+2
| | | | | | | | with the tag '\summary:' for greping. Remark: Currently some printers have no summary line. Moreover: Summarize all printers with a single line in INSTALL.txt
* Squelch a warning and get rid of a duplicate assignment.Guy Harris2016-08-071-2/+1
|
* Rename 'tcpdump-stdinc.h' to 'netdissect-stdinc.h'Francois-Xavier Le Bail2015-09-101-1/+1
| | | | Get the full log via: git log --follow netdissect-stdinc.h
* Printers must include 'netdissect.h', not 'interface.h'Francois-Xavier Le Bail2015-09-051-1/+1
|
* dismiss NETDISSECT_REWORKED macroDenis Ovsienko2015-03-221-1/+0
| | | | | | | The purpose of this macro was to enable the file-by-file switch to NDO, after which only tcpdump.c had a use of it and the definitions guarded by it. Update tcpdump.c not to require them any more and dismiss the unused definitions.
* Leave it up to ip6_print() to handle non-IPv6-capable systems.Guy Harris2014-10-011-4/+6
| | | | | | | | | | | | Always define and declare ip6_print(), always compile print-ip6.c, and always call it if we recognize a payload as IPv6. If INET6 isn't defined, ip6_print() will just print the length and note that printing isn't supported. That way, we don't do weird dissection of IPv6 packets on systems without IPv6 support, due to, for example, ethertype_print() returning 0 ("not dissected") for IPv6 packets on those systems (IPv6-over-Frame Relay was dissected weirdly due to this).
* u_intN_t is dead, long live uintN_t.Guy Harris2014-04-231-4/+4
| | | | | | | | | And, as we require at least autoconf 2.61, and as autoconf 2.61 and later have AC_TYPE_UINTn_T and AC_TYPE_INTn_T macros, we use them to define the uintN_t and intN_t macros if the system doesn't define them for us. This lets us get rid of bitypes.h as well.
* make use of ND_DEFAULTPRINT()Denis Ovsienko2014-03-261-1/+1
|
* make use of NETDISSECT_REWORKEDDenis Ovsienko2014-03-151-1/+2
| | | | | Update the already converted decoders to define the macro and to include interface.h instead of netdissect.h. Fix incurred compile errors.
* NDOize 8 more small decodersDenis Ovsienko2014-03-131-22/+21
| | | | | This change converts ZeroMQ, IPX, MPLS, IPv6 options, PPPoE, RIPng, PFLOG and Sun RPC decoders.
* don't include pcap.h needlesslyDenis Ovsienko2014-02-281-1/+0
| | | | | | | | | | Both interface.h and netdissect.h include <pcap.h>, thus most files should not include it regardless if these need it or not. The only exceptions so far remain: * addrtoname.c * missing/datalinks.c * missing/dlnames.c * tcpdump.c
* don't include addrtoname.h needlesslyDenis Ovsienko2014-02-251-1/+0
|
* Fix build on FreeBSD.Wesley Shields2014-01-031-3/+3
| | | | | Looks like there was a mistake made in d8acd8f that broke the build on systems where print-pflog.c is compiled. This fixes the build.
* remove tcpdump's own CVS keywordsDenis Ovsienko2014-01-031-5/+0
| | | | | | Remove lots of $Header's and a few $Id's that all belong to the former CVS repository of tcpdump itself. These keywords have been frozen since the migration to git in late 2008.
* whitespace changesMichael Richardson2014-01-011-2/+2
|
* make consistent use of the "tstr" idiomDenis Ovsienko2013-12-261-3/+5
| | | | | | | | For each decoder that has more than one instance of truncation signaling and prints the same string in each instance make sure that the string is declared as "static const char tstr[]" right after the initial includes block. Where necessary, replace fputs(s, stdout) with equivalent printf("%s", s).
* justify declarations of struct tok arraysDenis Ovsienko2013-09-241-3/+3
| | | | | | Make sure all of them are declared const and most of them -- static. Proper declaration of token arrays is a common review point for new code that is based on existing decoders. Thus fix the issue at its root.
* ip6_print() now takes a netdissect_options pointer as its first argument.Guy Harris2011-01-231-1/+1
|
* Fix build on systems with PF.Wesley Shields2010-03-311-0/+1
| | | | Reviewed-By: Guy Harris <guy@alum.mit.edu>
* Don't directly fetch multi-byte integers from packets.Guy Harris2010-02-211-2/+2
| | | | | | | | Use the EXTRACT_ macros to extract multi-byte integral values from packets, rather than just dereferencing pointers into the packet; there is no guarantee that the packet data will be aligned on the right boundary, and there is no guarantee that, if they're not, a direct access will work correctly.
* From Max Laier: check whether the system has <net/pfvar.h> and:guy2007-09-121-2/+10
| | | | | | | | | | | if it does, use that for the pf definitions; if it doesn't, don't compile in pf support; as both OpenBSD and FreeBSD have changed the pf definitions and header format without changing the DLT value, so you can't reliably read pflog-format libpcap files on a machine running an OS version other than the one on which the file was generated.
* From Jun Kuriyama:guy2006-10-251-1/+10
| | | | | | | | | I noticed tcpdump (on FreeBSD 6.1) cannot show pflog reason value 8 (should be "ip-option"). I made a patch for print-pflog.c to add more values which obtained from /usr/include/net/pfvar.h on FreeBSD 6.1.
* Add a flag to suppress the "default_print()" call made in variousguy2005-07-071-2/+2
| | | | | | | | link-layer print routines if no other print routine claimed the packet. Test whether that flag is set rather than testing whether neither of -x or -q were specified, and have -x, -q, *and* -X set that flag, so that -X suppresses it just as -x does. That way you don't get those pckets dumped twice if -X was specified.
* refactored ip_print() so that chained header parser (ESP/AH) canmcr2005-04-061-2/+9
| | | | more easily call the inner parts.
* Save the host-byte-order values for the rule number and sub rule numberguy2004-04-021-5/+8
| | | | | in variables; this means we put them in host byte order only once, and also gets rid of some "int format, long int argument" warnings.
* Get rid of some unused variables.guy2004-03-291-5/+1
|
* Update pf handling for new DLT_PFLOG (117) as other systems arefenner2004-03-281-55/+79
| | | | | starting to adopt it. Don't bother being backwards compatible to old value (17).
* Have the configure script arrange that the Makefile define _U_guy2003-11-161-4/+4
| | | | | | | | | | appropriately, and that GNUmakefile and the MSVC++ project file define it apppriately, as we do with libpcap, rather than defining it in "interface.h". Undo the rcsid-shuffling and addition of extra #includes, as we no longer need to arrange that "interface.h" be included before using _U_ in an RCS ID or copyright.
* From Neil Spring:guy2003-11-151-4/+4
| | | | | | | | | | | use "_U_" in the definitions of "rcsid[]", to eliminate complaints about those variables being unused; move the definitions after the include of "interface.h", or add an include of "interface.h", so that "_U_" is defined. Include "config.h" before including "tcpdump-stdinc.h" in "missing/datalinks.c".