summaryrefslogtreecommitdiff
path: root/print-isakmp.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Rename EXTRACT_ macrosFrancois-Xavier Le Bail2017-11-221-8/+8
| | | | | | | | | | | | | | | | 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 ND_TCHECK_/ND_TTEST_ macrosFrancois-Xavier Le Bail2017-11-221-5/+5
| | | | | | | | Now all the macros have a name meaning a count in bytes. e.g.: ND_TCHECK_32BITS -> ND_TCHECK_4 ND_TTEST_32BITS -> ND_TTEST_4
* More EXTRACT_8BITS() and other cleanups.Guy Harris2017-11-221-1/+1
| | | | | | | | | | Get rid of casts to (int) that aren't needed or wanted. If a field is unsigned, use an unsigned variable for it, print it with %u, not %d, and don't cast it to int. Replace a static variable in print-dvmrp.c with a local variable in dvmrp_print() and a parameter to print_neighbors2().
* Use pointer expressions like in most similar casesFrancois-Xavier Le Bail2017-11-201-5/+5
|
* Rename EXTRACT_nBITS() macros to EXTRACT_BE_nBITS()Francois-Xavier Le Bail2017-11-181-8/+8
| | | | | It indicates clearly that these macros are used to extract big-endian integral values.
* CVE-2017-13690/IKEv2: Fix some bounds checks.Guy Harris2017-09-131-7/+14
| | | | | | | | | | | | | | | Use a pointer of the correct type in ND_TCHECK(), or use ND_TCHECK2() and provide the correct length. While we're at it, remove the blank line between some checks and the UNALIGNED_MEMCPY()s they protect. Also, note the places where we print the entire payload. This fixes a buffer over-read discovered by Bhargava Shastry, SecT/TU Berlin. Add a test using the capture file supplied by the reporter(s).
* CVE-2017-13689/IKEv1: Fix addr+subnet length check.Guy Harris2017-09-131-2/+2
| | | | | | | | | | An IPv6 address plus subnet mask is 32 bytes, not 20 bytes. 16 bytes of IPv6 address, 16 bytes of subnet mask. This fixes a buffer over-read discovered by Bhargava Shastry, SecT/TU Berlin. Add a test using the capture file supplied by the reporter(s).
* CVE-2017-13039/IKEv1: Do more bounds checking.Guy Harris2017-09-131-25/+58
| | | | | | | | | | | | Have ikev1_attrmap_print() and ikev1_attr_print() do full bounds checking, and return null on a bounds overflow. Have their callers check for a null return. This fixes a buffer over-read discovered by Bhargava Shastry, SecT/TU Berlin. Add a test using the capture file supplied by the reporter(s), modified so the capture file won't be rejected as an invalid capture.
* CVE-2017-12990/Fix printing of ISAKMPv1 Notification payload data.Guy Harris2017-09-131-52/+60
| | | | | | | | | | | | | | | The closest thing to a specification for the contents of the payload data is draft-ietf-ipsec-notifymsg-04, and nothing in there says that it is ever a complete ISAKMP message, so don't dissect types we don't have specific code for as a complete ISAKMP message. While we're at it, fix a comment, and clean up printing of V1 Nonce, V2 Authentication payloads, and v2 Notice payloads. This fixes an infinite loop discovered by Forcepoint's security researchers Otto Airamo & Antti Levomäki. Add a test using the capture file supplied by the reporter(s).
* CVE-2017-12896/ISAKMP: Do bounds checks in isakmp_rfc3948_print().Guy Harris2017-09-131-1/+2
| | | | | | This fixes a buffer over-read discovered by Kamil Frankowicz. Add a test using the capture file supplied by the reporter(s).
* Use a table instead of getprotobynumber().Denis Ovsienko2017-08-271-3/+4
| | | | | | | | | | | | | | | | | | | On Linux getprotobynumber() returns different results for the same argument depending on the contents of /etc/protocols at runtime (expectedly but gets in the way of reproducible test cases). On FreeBSD it returns results that are irrelevant of the contents of /etc/protocols at runtime (unexpectedly). Other implementations exist and may expose interesting properties too. And if the host uses LDAP instead of /etc/protocols for name services, a call to that function may cause LDAP handle the request. All of the above is not right for the specific task of network protocols decoding, which needs to be fast and deterministic. As the protocol number space is just 8-bit, add a 256-element array of strings/NULLs for the translation and a wrapper function around it for index range enforcement. Change the code to use the new function instead of getprotobynumber(). Fix a typo while at it.
* If -n is specified, don't look up IP protocol numbers.Guy Harris2017-08-261-2/+1
| | | | | | | | In ISAKMP, that means "add a test for the -n flag". In CNFP, that means "if -n is specified, don't even bother doing the lookup, don't do the lookup and then ignore the result" - the latter just wastes resources doing the lookup.
* CVE-2017-5205/Clean up parsing of IKEv2 Security Associations.Guy Harris2017-01-181-33/+146
| | | | | | | | | | | | | | | | | | | | | | The payload of a Security Association has a sequence of proposal substructures; the Last Substruc field should only be 0 (for the last proposal substructure) or 2 (if there's another proposal substructure after the current one). If it's neither, don't try to dissect the next item as a payload with the Last Substruc field's value as a payload type. The payload of a proposal substructure has a sequence of transform substructures; the Last Substruc field should only be 0 (for the last transform substructure) or 3 (if there's another transform substructure after the current one). If it's neither, don't try to dissect the next item as a payload with the Last Substruc field's value as a payload type. That keeps us from trying to, for example, dissect a bogus substructure as an encrypted payload item and passing a null pointer as the struct isakmp structure pointer. Do more checks while we're at it.
* Declare some variables as staticFrancois-Xavier Le Bail2016-09-111-2/+2
|
* Fix used but marked unused parametersFrancois-Xavier Le Bail2016-08-191-8/+8
|
* 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-16/+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 warnings as "comma at end of enumerator list"Francois-Xavier Le Bail2015-08-191-3/+3
| | | | | The warnings were: comma at end of enumerator list [-Wpedantic]
* Fix warnings as "declaration of 'x' shadows a previous local"Francois-Xavier Le Bail2015-07-121-10/+10
|
* Fix misedit.Guy Harris2015-04-261-1/+1
|
* Fix a bunch of de-constifications.Guy Harris2015-04-261-111/+113
|
* 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.
* Clean up protocol ID printing.Guy Harris2014-05-031-14/+6
| | | | | | | | | | | If getprotobynumber() doesn't return a valid protocol name, just print the protocol number. Don't bother with setprotoent() and endprotoent() - none of the other dissectors using getprotobynumber() use them and, if it's a useful optimization, we should do the optimization in a common routine for all callers (or do some other optimization, e.g. reading the entire protocol list and building a table in which we can do a quick lookup).
* u_intN_t is dead, long live uintN_t.Guy Harris2014-04-231-157/+157
| | | | | | | | | 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.
* The item_len argument to ikev1_id_print() *is* used.Guy Harris2014-04-181-1/+1
| | | | | | So don't mark it as unused; that *might* be what's causing Coverity to think that sizeof(struct ikev1_pl_id) is always < item_len and thus that the "data" variable can never be null.
* Netdissectify the to-name resolution routines.Guy Harris2014-04-041-9/+9
| | | | | | | | 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 safeputs() and safeputchar()Denis Ovsienko2014-04-011-1/+1
|
* refine some past NDO conversionsDenis Ovsienko2014-03-121-2/+0
| | | | Don't include unneeded headers and replace a few remaining printf's.
* Do our own isascii(), isprint(), isgraph(), and toascii().Guy Harris2014-02-021-2/+2
| | | | | | | | | We do *not* want the behavior of isprint() and isgraph() to be locale-dependent - we want both of them to return "true" only for ASCII characters. We have to do our own isascii() and toascii() on non-UN*X systems anyway, so let's just do all of them ourselves.
* Only do the unaligned_mem{cpy,cmp} hack if necessary.Guy Harris2014-01-171-40/+40
| | | | If the processor does unaligned accesses, it's not necessary.
* We no longer use struct sockaddr_storage, so we don't need to define it.Guy Harris2014-01-171-4/+0
|
* Fix some more unaligned accesses.Guy Harris2014-01-161-5/+8
|
* Rework the cookie cache.Guy Harris2014-01-161-94/+35
| | | | | This simplifies the code, gets rid of some type-punning about which GCC warns, and reduces the size of the cache entries.
* Get rid of form feed in source.Guy Harris2014-01-151-1/+0
|
* Move safememcpy() to util.c so it doesn't get inlined.Guy Harris2014-01-151-50/+38
| | | | | | | | | | | It appears that some C compilers will inline safememcpy() *and* will, as a result, optimize to assume alignment it if it's passed a putatively-aligned pointer. As the pointers in question are not guaranteed to be aligned, that can cause crashes on, for example, SPARC. Also, rename the function to unaligned_memcpy(), to clarify what's "safe" about it, and change some direct memcpy() calls to use it as well.
* Fix a bug the previous change made a bit more obvious.Guy Harris2014-01-151-1/+1
|
* Don't use a u_int16_t * to extract data from packets.Guy Harris2014-01-151-16/+12
| | | | | That convinces some compilers that the data is 16-bit aligned, but there's no such guarantee of alignment.
* 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.
* Merge branch 'master' of git+ssh://bpf.tcpdump.org/tcpdump/master/git/tcpdumpMichael Richardson2014-01-011-3/+524
|\ | | | | | | | | Conflicts: enc.h
| * Pull a bunch of headers into the only source file that includes them.Guy Harris2013-12-301-3/+524
| | | | | | | | | | | | 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.
* | whitespace changesMichael Richardson2014-01-011-52/+52
|/
* make more array declarations static/constDenis Ovsienko2013-12-191-3/+3
|
* Fix compilation warnings:Gleb Smirnoff2013-11-261-12/+2
| | | | | - set but unused variables - type punned casts
* finalize the evp.h bugfix (#46)Denis Ovsienko2013-06-091-0/+7
|
* "sa_len" is, on some platforms, #defined to something else; useGuy Harris2009-06-291-5/+5
| | | | | "sa_length" instead, so as not to have compilation fail on those platforms. Do the same with "osa_len" while we're at it.
* Make the definition of ikev1_print() match its declaration - at leastGuy Harris2009-06-091-1/+1
| | | | one version of HP's C compiler complains otherwise.
* Add __attribute__((format)) to the declarations of the ndo_printf,Guy Harris2009-05-241-2/+2
| | | | | | | | | | | | | | | | ndo_error, and ndo_warning function pointers in a netdissect_options structure. Fix some errors adding that caught. Have the RRCP dissector extract fields itself, with the EXTRACT_ macros and a u_char pointer, rather than printing numbers from a structure which doesn't put structure members on natural boundaries (__attribute__((packed)) doesn't help, as not all compilers support it) - note also that not all processors support dereferencing unaligned pointers, e.g. SPARC - and assuming some fields are in the "right" byte order. Also have it check whether data is available in the packet before referring to it.