Commit Graph

30 Commits

Author SHA1 Message Date
Francois-Xavier Le Bail
5a76f1a5e2 Fix a typo
[skip ci]
2021-07-18 09:54:18 +02:00
Matthew Martin
ad090fd01a DNS: Sync types with IANA
IANA reference:
https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml

Remove the UNSPECA type parsing as IANA has that query type number
assigned to NID now.
2021-05-18 17:09:42 +00:00
Guy Harris
92d636a906 dns: add some additional error checks.
If the upper 2 bits of a label/pointer value are 10, treat that as an
error.

If a name is longer than 255 characters, treat that as an error.

This prevents some long loops with malformed packets, as found by Hardik
Shah.
2020-11-14 20:34:25 -08:00
jacobgb24
6bb25b4b4c DNS: Update printing the EDNS options and their data with -vv
(pull request #808)

Format of EDNS options matches format of TCP options.
2020-04-10 13:17:44 +02:00
Casey Deccio
27bf32ee31 DNS: Add printing the EDNS options
(pull request #762)
2020-04-10 13:17:35 +02:00
Wang Jian
79c7ffc667 Add support for decoding DNS URI RR (typecode 256, RFC7553) 2019-04-13 16:08:03 +08:00
Francois-Xavier Le Bail
8382e04eec DNS: Coding style update 2018-01-02 16:57:13 +01:00
Guy Harris
37185d198e Use nd_ types for DNS.
Make some types unsigned, and fix some loops to no longer depend on a
zero count rolling over to -1 when decremented.
2017-12-13 09:32:44 -08:00
Guy Harris
d841ae4103 Get rid of an unused structure. 2017-12-10 23:56:16 -08:00
Francois-Xavier Le Bail
fa2faabe61 Remove unused macros in nameser.h 2017-12-10 22:21:37 +01:00
Denis Ovsienko
3951a87cbe spell ASCII in uppercase 2017-08-10 09:52:46 +01:00
Denis Ovsienko
3ba4165c4b refine use of nameser.h
Move the port number #define's to the TCP and UDP files such that they
don't require nameser.h anymore. Update the TCP printer to disregard the
multicast DNS port as it is UDP-only.
2015-07-13 10:15:32 +01:00
Guy Harris
dbddfda2c8 More getting rid of old u_intN_t. 2014-04-23 00:45:13 -07:00
Denis Ovsienko
fe3253b9b8 remove tcpdump's own CVS keywords
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.
2014-01-03 00:59:08 +04:00
guy
f0ededcff9 The topmost bit in the class field isn't a "cache flush" flag in mDNS
queries.  Display that bit correctly (as per Marc Krochmal's request).

In mDNS, the topmost bit of the class field should be handled the same
way regardless of the value of the lower 15 bits, and *vice versa* -
they're independent fields.
2006-11-10 03:18:21 +00:00
guy
c245819b11 From Wesley Griffin <wgriffin@users.sourceforge.net>: update the list of
DNS RR typecodes.
2006-04-07 08:47:34 +00:00
guy
f4d64fe38b In mDNS, report IN-class records with the "cache flush" bit set as such,
rather than as "Class 32769".
2003-11-05 06:02:58 +00:00
guy
fcc82f451d The "__attribute__((packed))" tag on structures causes some files not to
compile with Sun C, as "interface.h" isn't being included before the
structures are being declared.

Furthermore, in the files that Sun C *can* compile, it doesn't cause Sun
C to generate code that's safe with unaligned accesses, as
"__attribute__" is defined as a do-nothing macro with compilers that
don't support it.

Therefore, we get rid of that tag on the structures to which it was
added, and instead use "EXTRACT_16BIT()" and "EXTRACT_32BIT()" to fetch
16-bit and 32-bit big-endian quantities from packets.  We also fix some
other references to multi-byte quantities to get rid of code that tries
to do unaligned loads on platforms that don't support them.

We also throw in a hack that makes those macros use
"__attribute__((packed))" on structures containing only one 16-bit or
32-bit integer to get the compiler to generate unaligned-safe code
rather than doing it by hand.  (GCC on SPARC produces the same code that
doing it by hand does; I don't know if GCC on any other big-endian
strict-alignment processor generates better code for that case.  On
little-endian processors, as "ntohs()" and "ntohl()" might be functions,
that might actually produce worse code.)

Fix some places to use "%u" rather than "%d" to print unsigned
quantities.
2002-12-11 07:13:49 +00:00
itojun
10afb02ac8 put __attribute__((packed)) to packet headers. s/u_short/u_int16_t/ and so
forth while i'm here
2002-11-09 17:19:16 +00:00
itojun
5a5ccbf6d3 dissect traffic on port 5353 as multicast DNS. vlubet@apple.com 2002-08-16 22:40:33 +00:00
itojun
111ff8a61d whitespace cleanup 2002-06-11 17:08:37 +00:00
guy
c3d82102cd Yet *another* #define of ours that an OS also defines; in this case it's
T_NULL, defined by some STREAMS/TPI/XTI/TLI/whatever header file in
HP-UX - if it's defined, undefine it before we define it, to squelch
compiler warnings.
2001-06-27 05:40:16 +00:00
guy
e4b93879cf Move all the "undefine so that the compiler doesn't whine about
redefinitions" stuff from files that include "nameser.h" to "nameser.h"
itself (we used to include <arpa/nameser.h>, over which we had no
control so we couldn't do that, but we now have our own "nameser.h").
Add T_OPT to the list of things we undefine, and undefine T_UNSPEC iff
T_UNSPEC is defined, not iff NOERROR is defined.

Replace the include of <arpa/nameser.h> in "print-rx.c" with an include
of "nameser.h", and "#if 0" it out pending a determination of whether
it's necessary (why would AFS's RX care about the internals of DNS
packets?) or not.
2001-06-26 06:19:03 +00:00
itojun
e8bcb0d14e add TKEY, TSIG and IXFR 2001-02-20 06:31:34 +00:00
itojun
c981dfc94b move T_xx and C_xx fallback definitions into nameser.h. 2001-01-28 07:47:56 +00:00
itojun
041e99f6c0 support DNAME and bit string label. more pedantic snapend validation.
{jinmei,itojun}@kame.net
2000-12-28 20:30:41 +00:00
guy
4881292df0 Give a bunch of files RCS and SCCS IDs. 2000-12-17 23:07:48 +00:00
itojun
535dd007b3 some sprintf fixes, from kris@freebsd.org (patches@tcpdump.org #89)
pedant.
2000-10-05 04:10:00 +00:00
guy
5bad3420c9 Bitfield layout in memory is not specified by the ANSI C spec; don't use
C bitfields to specify the layout of a DNS request or response header,
use shifts and masks to extract the bitfields.
2000-10-03 09:13:25 +00:00
assar
af07258a7e do not rely on the system providing us everything we need in
<arpa/nameser.h> but include a nameser.h with all the required stuff.
From Guy Harris <gharris@flashcom.net>
2000-07-05 23:50:37 +00:00