summaryrefslogtreecommitdiff
path: root/print-llc.c
Commit message (Collapse)AuthorAgeFilesLines
* Rework "Update more link-layer dissectors to void functions"Francois-Xavier Le Bail2020-08-061-1/+1
| | | | | | | | | | It's a follow-up to commit 81dbf4a0b05092760d0ff0cdd48c692e4769ba99. There is no need to update ether_print(), ether_common_print() and ether_switch_tag_print() to void functions: back to u_int functions. There is also no need to add a flag parameter to ether_print(), ether_common_print() and ether_switch_tag_print(): Remove it.
* Update more link-layer dissectors to void functionsFrancois-Xavier Le Bail2020-07-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | brcm_tag_if_print() brcm_tag_prepend_if_print() dsa_if_print() edsa_if_print() ether_if_print() netanalyzer_if_print() netanalyzer_transparent_if_print() Update ether_print(), ether_common_print() and ether_switch_tag_print() to void functions. Add a flag parameter to ether_print(), ether_common_print() and ether_switch_tag_print() to increment the link-layer header length field of the netdissect_options when needed. The calls use TRUE when the return value of the funtions was used. The calls with FALSE avoid increments when the calls are nested. Moreover: Remove trailing "_if" from some protocol names.
* Use the new GET_ macros instead of the EXTRACT_ onesFrancois-Xavier Le Bail2019-03-261-9/+9
| | | | | | | 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.
* Add more nd_print_trunc() callsFrancois-Xavier Le Bail2018-05-101-7/+7
| | | | | | | Update the output of some tests accordingly. Moreover: Add a ndo_protocol field assignment.
* Remove useless commentsFrancois-Xavier Le Bail2018-03-191-8/+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-36/+36
|
* Remove all storage class specifier 'register'Francois-Xavier Le Bail2017-12-131-2/+2
| | | | | | Let the compiler do the optimizations (or not) based on build options. Avoid 'value has been optimized out' messages in gdb using '-O0'.
* Use nd_ types in 802.x and FDDI headers.Guy Harris2017-12-121-5/+5
| | | | | | | | | | | | | | | | | | | Use EXTRACT_U_1() as required by those changes. Remove no-longer-necessary & operators from other EXTRACT_ calls. While we're at it, add MAC_ADDR_LEN to netdissect.h, and use it instead of ETHER_ADDR_LEN; eliminate ETHER_ADDR_LEN. Move the maximum Ethernet length field value to ethertype.h, under the name MAX_ETHERNET_LENGTH_VAL. Move the Ethernet header structure, and the #define for the Ethernet header length, to print-ether.c; in non-Ethernet dissectors that were using the Ethernet header structure, just declare two nd_mac_addr variables for the source and destination MAC addresses and use them instead of the Ethernet header (we don't need the type field there). These changes leave nothing in ether.h, so eliminate it.
* Replace ND_TTEST2()/ND_TCHECK2() macros by macros using pointers (1/n)Francois-Xavier Le Bail2017-12-111-3/+3
| | | | | ND_TTEST2(var, l) -> ND_TTEST_LEN(p, l) ND_TCHECK2(var, l) -> ND_TCHECK_LEN(p, l)
* Another EXTRACT_U_1() replacing a direct dereference.Guy Harris2017-12-081-1/+1
|
* Use more the EXTRACT_U_1() macro (47/n)Francois-Xavier Le Bail2017-12-051-1/+1
| | | | In: if (... *(p) ...) ...
* Use more the EXTRACT_U_1() macro (28/n)Francois-Xavier Le Bail2017-11-261-1/+3
| | | | | | In ND_PRINT() macro call(s) (step 7). p[n] ...
* Use more ND_TCHECK_n()/ND_TTEST_n() macrosFrancois-Xavier Le Bail2017-11-241-1/+1
|
* Rename EXTRACT_ macrosFrancois-Xavier Le Bail2017-11-221-5/+5
| | | | | | | | | | | | | | | | 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
* Use more the EXTRACT_8BITS() macro to fetch a one-byte value (18/n)Francois-Xavier Le Bail2017-11-211-2/+2
| | | | | | Assignment, *(p op e) Partial list.
* 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.
* CVE-2017-12897/ISO CLNS: Use ND_TTEST() for the bounds checks in ↵Guy Harris2017-09-131-1/+1
| | | | | | | | | | | isoclns_print(). This fixes a buffer over-read discovered by Kamil Frankowicz. Don't pass the remaining caplen - that's too hard to get right, and we were getting it wrong in at least one case; just use ND_TTEST(). Add a test using the capture file supplied by the reporter(s).
* Fix previous bounds checks.Guy Harris2017-01-181-2/+15
| | | | | | | An XID could have no payload, e.g. an SNA "short form" XID. If it *does* have a payload, and it's a "basic form" XID, it needs to be at least 3 bytes long, not 2 bytes long.
* CVE-2016-7930/Add a bounds check.Guy Harris2017-01-181-0/+6
| | | | Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
* CVE-2016-7985,7986/Change the way protocols print link-layer addresses.Guy Harris2017-01-181-15/+16
| | | | | | | | | | | | | | | If a protocol that runs under a link-layer protocol would print the link-layer addresses for the packet as source and destination addresses for the packet, don't have it blithely assume those link-layer addresses are present or are at a particular offset from the beginning of that protocol's data; Ethertypes, for example, are used by a number of protocols, not all of which have Ethernet headers and not all of which have any MAC headers. Instead, pass the printers for those protocols structures with a pointer to the address data and a pointer to a routine that prints the address. Fixes some heap overflows found with American Fuzzy Lop by Hanno Böck.
* 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
* Get rid of "TCPDUMP" in some libnetdissect codesFrancois-Xavier Le Bail2015-10-081-1/+1
|
* hdrlen is never > INT_MAX, and we negate it, so make it an int.Guy Harris2015-09-141-1/+1
| | | | This squelches some compiler warnings.
* 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
* Remove obsolete commentsFrancois-Xavier Le Bail2015-09-071-1/+1
|
* Printers must include 'netdissect.h', not 'interface.h'Francois-Xavier Le Bail2015-09-051-1/+1
|
* Fix a bunch of de-constifications.Guy Harris2015-04-261-4/+4
|
* Skip the LLC header after printing information for it.Guy Harris2015-04-181-7/+7
| | | | No effect on behavior, but looks a bit nicer.
* With -e, print the LLC header before the SNAP header; without it, cut the ↵Guy Harris2015-04-181-41/+54
| | | | | | | | SNAP header. With -e, write out everything; without -e, just write the SNAP header and, if the OUI is 000000, don't report it, and report the PID as an ethertype.
* Skip the LLC and SNAP headers with -x.Guy Harris2015-04-171-39/+55
| | | | | | | Have llc_print() return the length of the LLC header, plus the length of the SNAP header, if available - or, if it couldn't dissect the payload, return the *negative* of that sum. Use that return value in link-layer printers.
* Fix the printing of RFC 948-style IP packets.Guy Harris2015-04-171-6/+7
| | | | | They have a 3-octet LLC UI frame followed *immediately* by an IP packet; the payload is 3 bytes, not 4 bytes, past the LLC header.
* Clean up printing of LLC packets.Guy Harris2015-04-171-34/+59
| | | | | | | | | | | | | | | | | | | Don't print LLC header information for SNAP packets; if we have a SNAP header, just call snap_print() and return its return value, regardless of whether it's 1 or 0, don't fall into the code to print raw LLC header information - and don't print it with -e, either. If llc_print() returns 0, just call the default packet printer, don't print the MAC-layer header or the extracted ethertype - llc_print() will print the source and destination MAC addresses and whatever type information is in the LLC or SNAP headers. If we don't know the DSAP/LSAP, and it's an information frame (numbered or not) and not an XID frame, return 0, so that we give a hex dump of the raw payload. In addition, print the length when printing SNAP header information with -e.
* 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.
* Fix length checking.Guy Harris2014-12-181-4/+11
| | | | | | | | | | | | | Check both the captured length and the on-the-wire length (the latter *should* be greater than or equal to the former, but that's not guaranteed). Add some additional length checks, so neither caplen nor length underflow. If we stop dissecting because the packet is too short, return 1, not 0, as we've "dissected" what we can; 0 means "this is LLC+SNAP with an OUI of 0 and an unknown Ethertype".
* 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.
* Netdissectify the to-name resolution routines.Guy Harris2014-04-041-4/+4
| | | | | | | | Have them take a netdissect_options * argument, and get the "no name resolution" flag from it. Move the declaration of dnaddr_string to addrtoname.h, along with the other XXX-to-string routines.
* fixup a few ND_DEFAULTPRINT() use casesDenis Ovsienko2014-04-021-2/+2
|
* NDOize SMB decoderDenis Ovsienko2014-04-021-1/+1
|
* NDOize AppleTalk, CDP and Kerberos decodersDenis Ovsienko2014-03-281-1/+1
|
* NDOize ISO CLNS decoderDenis Ovsienko2014-03-281-1/+1
|
* print-llc: add a missing breakFrancois-Xavier Le Bail2014-03-241-0/+1
|
* NDOize ATM, MPTCP, NTP, VTP & Whiteboard decodersDenis Ovsienko2014-03-201-1/+1
|
* NDOize EIGRP, ICMP, L2TP, STP and UDP decodersDenis Ovsienko2014-03-151-3/+3
|
* NDOize LLC decoderDenis Ovsienko2014-03-151-50/+48
|
* NDOize FDDI, MPCP, Token Ring, VQP and Zephyr decodersDenis Ovsienko2014-03-141-2/+2
|
* NDOize 8 more small decodersDenis Ovsienko2014-03-131-2/+2
| | | | | This change converts ZeroMQ, IPX, MPLS, IPv6 options, PPPoE, RIPng, PFLOG and Sun RPC decoders.
* print-llc: some variables are updated and their new values are never usedFrancois-Xavier Le Bail2014-03-071-10/+0
|