summaryrefslogtreecommitdiff
path: root/print-aodv.c
Commit message (Collapse)AuthorAgeFilesLines
* Update the ND_LCHECK*() macros to ND_ICHECK*() macrosFrancois-Xavier Le Bail2021-12-291-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | ICHECK like Invalid-Check. Reminder: If the checked expression is true an error message is printed and a 'goto invalid' is executed. This change adds the parameter 'operator'. Before this change, '<' comparison was hard coded. We can do now: ND_ICHECK_U(length, <, HEADER_LEN); ND_ICHECK_U(length, ==, 24); ND_ICHECK_U(length, !=, 8); ND_ICHECK_ZU(length, <, sizeof(struct my_struct)); ND_ICHECKMSG_U("message length", msg_tlen, <, 4); ... (Any comparison operator) Remark: The change of names from ND_LCHECK*() to ND_ICHECK*() is because something else than a length(L) can be checked. Moreover: Place the 'message' parameter at the beginning of ND_ICHECKMSG_U() and ND_ICHECKMSG_ZU() paramaters lists.
* Try the new ND_LCHECK*() macros. [skip ci]Denis Ovsienko2021-01-171-36/+9
|
* AODV: Modernize packet parsing style.Denis Ovsienko2021-01-151-196/+77
| | | | | | | | | Make all ND_TCHECK_SIZE() instances redundant and remove them. Always print a reason when reporting a packet as invalid. Undo the changes from commit f875106 to remove support for draft-perkins-aodv6-01, which had expired in 2001. Use tok2str() to print the message type. Don't print an additional "v6" for RREQ, as the address family is apparent from the UDP header. Update a test.
* Remove many (762) now redundant ND_TCHECK_n() callsFrancois-Xavier Le Bail2020-09-061-5/+0
| | | | | | | | | | | ND_TCHECK_n(e), n in { 1, 2, 3, 4, 8 }. They are redundant because they are followed by a GET_.*_n(e) call, same n, same e, which do the bounds check. Remove unused 'trunc' labels and most associated codes. Update the outputs of some tests accordingly.
* More bounds checking when fetching addresses and converting to strings.Guy Harris2020-01-191-15/+15
| | | | | | | | | | | | | | Replace more calls to ipaddr_string()/ip6addr_string() with calls to GET_IPADDR_STRING()/GET_IP6ADDR_STRING() macros performing bounds checking. Add similar bounds-checking inline functions and macros to wrap linkaddr_string(), etheraddr_string(), and isonsap_string() and convert calls to them to use the macros as well. Shuffle the inline functions in addrtoname.h around a bit, so that the inline functions, external declarations, and macros are all in the same order.
* Use the new GET_ macros instead of the EXTRACT_ onesFrancois-Xavier Le Bail2019-03-261-63/+65
| | | | | | | 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-181-11/+11
| | | | Update the output of a test accordingly.
* Add the ndo_protocol field in the netdissect_options structureFrancois-Xavier Le Bail2018-03-161-0/+1
| | | | | Update this field in printer entry functions. It will be used for some printings.
* AODV: Use nd_ipv4 type for IPv4 addressesFrancois-Xavier Le Bail2018-01-311-5/+5
|
* Merge branch 'master' of github.com:the-tcpdump-group/tcpdumpGuy Harris2018-01-311-2/+2
|\
| * Remove unneeded '&' when getting a pointer to a nd_ipv6 typeFrancois-Xavier Le Bail2018-01-311-12/+12
| |
* | Have ip{6}addr_string take a u_char * as the second argument.Guy Harris2018-01-311-15/+15
|/ | | | Fix warnings that introduces.
* Use nd_ipv6 rather than struct in6_addr in packet-layout structures.Guy Harris2018-01-301-10/+10
| | | | Also, use it, and nd_ipv4, in sizeof() operations.
* 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-43/+43
|
* Use ND_TTEST_SIZE()/ND_TCHECK_SIZE() macros (1/n)Francois-Xavier Le Bail2018-01-031-14/+14
|
* Use nd_ types, add EXTRACT_ macros as necessary.Guy Harris2017-12-291-131/+131
| | | | | Also, remove the l from formats and don't cast to unsigned long - not necessary.
* Use more the EXTRACT_U_1() macro (49/n)Francois-Xavier Le Bail2017-12-091-1/+1
| | | | Assignment, *(p)
* Use more the ND_TCHECK_1() macroFrancois-Xavier Le Bail2017-12-041-1/+1
|
* Rename EXTRACT_ macrosFrancois-Xavier Le Bail2017-11-221-19/+19
| | | | | | | | | | | | | | | | 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-19/+19
| | | | | It indicates clearly that these macros are used to extract big-endian integral values.
* CVE-2017-13002/AODV: Add some missing bounds checks.Guy Harris2017-09-131-1/+8
| | | | | | | | | | | | In aodv_extension() do a bounds check on the extension header before we look at it. This fixes a buffer over-read discovered by Kamil Frankowicz. Add a test using the capture file supplied by the reporter(s). While we're at it, add the RFC number, and check the validity of the length for the Hello extension.
* 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
* Don't require IPv6 library support in order to support IPv6 addresses.Guy Harris2015-09-171-54/+0
| | | | | | | | | | | | | Have our own routines to convert between IPv4/IPv6 addresses and strings; that helps if, for example, we want to build binary versions of tcpdump for Windows that can run both on NT 5 (W2K/WXP), which doesn't have inet_ntop() or inet_pton(), and NT 6 (Vista/7/8/10), which do. It also means that we don't require IPv6 library support on UN*X to print addresses (if somebody wants to build tcpdump for older UN*Xes lacking IPv6 support in the system library or in add-on libraries). Get rid of files in the missing directory that we don't need, and various no-longer-necessary autoconf tests.
* 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-3/+3
|
* 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.
* Report a too-long unreachable destination list.tcpdump-4.7.0-bpGuy Harris2014-11-121-12/+15
| | | | | | | | Running out of packet length before running out of unreachable destinations is an error; report it as such. Don't worry about leftover data past the end of the list of unreachable destinations.
* Not using offsetof() any more, so no need for <stddef.h>.Guy Harris2014-11-111-3/+0
|
* Further cleanups.Guy Harris2014-11-111-151/+126
| | | | | | | | | | | | Use ND_TCHECK() rather than home-brew bounds checks. Do simpler length checks. Let i be the length of the actual remaining packet data; use ND_TCHECK() inside loops that iterate over the remaining data. Let the printers for particular message types cast the raw data pointer to a pointer of the appropriate type, rather than passing two pointers, with different types, to the same data.
* Clean up error message printing.Guy Harris2014-11-111-42/+46
| | | | | | | | Have "struct aodv_rerr" just be the header, not including the actual destinations. Simplify the logic somewhat, and make it similar in the print routines for the three types of error messages.
* Add initial bounds check, get rid of union aodv.Guy Harris2014-11-111-144/+130
| | | | | | | | | Fetch the type field without using a structure, and check to make sure it's not past the end of the packet. Pass to each dissection routine a pointer to the appropriate message type structure, rather than a pointer to a union of all the message type structures.
* More fixes for uint8_t being shorter than u_int8_t.Guy Harris2014-04-231-33/+33
| | | | Fix a typo while we're at it.
* u_intN_t is dead, long live uintN_t.Guy Harris2014-04-231-56/+56
| | | | | | | | | 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-15/+15
| | | | | | | | 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.
* NDOize AODV, IPv4 and SCTP decodersDenis Ovsienko2014-03-261-111/+127
|
* The interval in an AODV HELLO extension is not aligned on a 4-byte boundary.Guy Harris2014-01-191-2/+3
|
* 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.
* Pull a bunch of headers into the only source file that includes them.Guy Harris2013-12-301-1/+154
| | | | | | For headers included in only one source file, put the header contents in the source file in question, and get rid of a bunch of stuff from the header not used in the source file.
* Add bounds checking.guy2004-03-241-9/+19
|
* 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".
* The now-expired draft-perkins-aodv6-01 specified a different order forguy2003-09-131-11/+120
| | | | | | | fields in most of the AODV messages when used with V6; print those correctly. Get rid of some "v6" tags that weren't there before my previous checkin.
* Use %[l]u, not %[l]d, to print unsigned quantities.guy2003-09-121-18/+18
|
* As itojun said, u_int32_t can be long or int, depending on the platform.guy2003-09-121-22/+23
|
* Updates from Bruce Simpson:guy2003-09-121-125/+180
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fix numerous bugs in my AODV submission, red faces all round, mainly due to misunderstanding of EXTRACT_STRING() macro arguments (because these are macros, type checking didn't happen). AODV HELLO extensions are now correctly printed. The code is closer to FreeBSD's style guidelines. Don't use "u_char" and "u_long", use "u_int8_t" and "u_int32_t". "u_long" is definitely wrong as it's 64 bits on some platforms; "u_char" is safe, but the official tcpdump style uses "u_int8_t". At least according to the (long-since-expired) draft-perkins-aodv6-01, the V6 AODV messages have different message type values from the V4 ones in draft-ietf-manet-aodv-13. However, draft-ietf-manet-aodv-13 says that the only differences are in the addresses; we support both. Clean up the way we tell the AODV6 dissector that we're running atop IPv6 a bit. Use "udpipaddr_print()" if we're printing AODV packets as a result of saying "anything that matches this filter is AODV", rather than doing it ourselves under the assumption that it's running over IPv4.
* Squelch a compiler warning.guy2003-09-061-3/+3
|