summaryrefslogtreecommitdiff
path: root/addrtoname.h
Commit message (Collapse)AuthorAgeFilesLines
* Introduce and use nd_trunc(). [skip ci]Denis Ovsienko2020-09-171-6/+6
| | | | | | | | | | | | | | | | | | | | This new function is a part of item 2 of the longjmp() conversion plan Francois-Xavier proposed on tcpdump-workers. As a noreturn function, it can fit uniformly at the end of any decoder function, regardless if void or not, for example: const u_char * something_print (netdissect_options *ndo, const u_char *cp, u_int len) { /* (some normal decoding) */ ND_TCHECK_2(cp); /* (some more normal decoding) */ return cp + len; trunc: nd_trunc(ndo); /* The compiler does not warn about a missing return. */ }
* More bounds checking when fetching addresses and converting to strings.Guy Harris2020-01-191-11/+39
| | | | | | | | | | | | | | 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.
* Add GET_IP{6}ADDR_STRING() macros and get_ip{6}addr_string() functionsFrancois-Xavier Le Bail2019-08-121-0/+18
| | | | | | | With setjmp/longjmp logic to call the ip{6}addr_string() functions after bounds checking. The macros must be used on a packet buffer pointer.
* Add GET_LE64ADDR_STRING() macro and get_le64addr_string() functionFrancois-Xavier Le Bail2019-06-291-0/+18
| | | | | | | With setjmp/longjmp logic to call the le64addr_string() function after bounds checking. The macro must be used on a packet buffer pointer.
* Make the hex-dumping routines for addresses take a uint8_t * argument.Guy Harris2018-05-141-4/+4
| | | | | | | | | | | | | | | | Hopefully, that will convince Coverity that the result of dereferencing those pointers will have a value between 0x00 and 0xff, and therefore that shifting that result right by 4 bits will yield a value between 0x0 and 0xf, and therefore that this result can safely be used as an index into the 16-element hex[] array. I guess Coverity wants us to realize that there really *are* C implementations out there with non-8-bit char and unsigned char values, even though getting tcpdump to work on them will probably be a highly entertaining exercise (not to mention that the only one I know of that's actually being *used* are the Unisys Clearpath Dorado series, and they're one's complement, which is yet *another* place where the port could be entertaining...).
* Remove the etherproto_string() unused functionFrancois-Xavier Le Bail2018-03-091-1/+0
|
* Have ip{6}addr_string take a u_char * as the second argument.Guy Harris2018-01-311-5/+2
| | | | Fix warnings that introduces.
* 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'.
* Remove the protoid_string() unused functionFrancois-Xavier Le Bail2017-11-211-1/+0
|
* CVE-2017-13016/ES-IS: Fix printing of addresses in RD PDUs.Guy Harris2017-09-131-1/+2
| | | | | | | | | | | | | Always print the SNPA, and flag it as such; only print it as a MAC address if it's 6 bytes long. Identify the NET as such. This fixes a buffer over-read discovered by Bhargava Shastry, SecT/TU Berlin. Add tests using the capture files supplied by the reporter(s), modified so the capture files won't be rejected as an invalid capture.
* Don't require IPv6 library support in order to support IPv6 addresses.Guy Harris2015-09-171-6/+8
| | | | | | | | | | | | | 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.
* Functions in libnetdissect must use ndo_error() functionFrancois-Xavier Le Bail2015-09-051-9/+9
|
* refine 802.1Q VLAN TCI decodingDenis Ovsienko2015-01-291-0/+1
| | | | | Factor the common code out to a new function and rename the CFI bit to DEI to match the terminology in Clause 9.6 of IEEE 802.1Q-2011.
* More getting rid of old u_intN_t.Guy Harris2014-04-231-2/+2
|
* Netdissectify the to-name resolution routines.Guy Harris2014-04-041-7/+8
| | | | | | | | 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.
* refine some declarations in header filesDenis Ovsienko2014-04-031-0/+3
| | | | | Remove duplicate declarations and move some other declarations to addrtoname.h where they belong.
* remove tcpdump's own CVS keywordsDenis Ovsienko2014-01-031-2/+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.
* Back out DLT_PFSYNC support.Guy Harris2012-02-291-1/+0
| | | | | | Unfortunately, the DLT_PFSYNC support depends on header files included from the pfctl command's source tree, and trying to arrange to find that would be too much trouble.
* Add DLT_PFSYNC support.Guy Harris2012-02-291-0/+1
| | | | | | From FreeBSD PR bin/124825: tcpdump(8) does not support pfsync(4) data, which in turn was ported over from OpenBSD. We already have CARP support, so we did not port that part over.
* addrtoname.[ch]: add a printer for Little-Endian 64-bit addressDmitry Eremin-Solenikov2010-03-091-0/+1
| | | | Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
* expose the BUFSIZE def to the outside worldhannes2007-08-081-1/+3
|
* rework the ARP printer & add support for Frame-Relay ARPhannes2006-02-111-2/+9
|
* Eliminate some unused parameters.fenner2001-09-171-9/+9
| | | | | | | | | | | Use const more. Use EXTRACT_* macros more. Use TCHECK* more. Use tok2str() to replace some home-grown workalikes. smb: - Get rid of private types, use tcpdump-defined types - Rename fdata and fdata1 to smb_fdata and smb_fdata1 to avoid conflict with IRIX library function.
* make arp_print() L2 neutral. from netbsditojun2001-06-181-1/+2
| | | | | | TODO: recover portions that peep L2 src/dst, by passing more args from L2 printing to arp_print(). the current code can bomb when L2 = arcnet (because the code assumes that L2 address len == 6), for example.
* Bring in KAME IPv6 tcpdump. replaces esp/ah/isakmp decoder.itojun1999-10-301-1/+10
| | | | | | | Hope I did not break anything. Portability on IPv4-only node needs checking, I'll do this very soon. (sorry for rather jumbo commit) XXx what is _FAVOR_BSD?
* Initial revisionmcr1999-10-071-0/+36