Commit Graph

28 Commits

Author SHA1 Message Date
Francois-Xavier Le Bail
ad3d3f5c67 Use more the EXTRACT_U_1() macro (33/n) 2017-11-29 08:06:21 +01:00
Francois-Xavier Le Bail
2858e729ed Use more the EXTRACT_U_1() macro (29/n)
In ND_PRINT() macro call(s) (step 8).

*(p + e)
2017-11-26 21:33:24 +01:00
Francois-Xavier Le Bail
39c8c55aa9 Use more ND_TCHECK_n()/ND_TTEST_n() macros 2017-11-24 22:48:55 +01:00
Francois-Xavier Le Bail
da20bc56d6 Rename EXTRACT_ macros
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
2017-11-22 23:54:09 +01:00
Francois-Xavier Le Bail
cb9b665059 Use more the EXTRACT_8BITS() macro to fetch a one-byte value (18/n)
Assignment, *(p op e)

Partial list.
2017-11-21 22:23:47 +01:00
Francois-Xavier Le Bail
8bb03d5309 Use more the EXTRACT_8BITS() macro to fetch a one-byte value (15/n)
Assignment, one operator (step 2).
(*e1) op e2
2017-11-21 18:25:06 +01:00
Guy Harris
56f36d92cc Point to some RRCP specifications. 2017-11-18 16:48:34 -08:00
Francois-Xavier Le Bail
577621026d Rename EXTRACT_nBITS() macros to EXTRACT_BE_nBITS()
It indicates clearly that these macros are used to extract big-endian
integral values.
2017-11-18 13:56:40 +01:00
Guy Harris
6bc44295cf CVE-2016-7985,7986/Change the way protocols print link-layer addresses.
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.
2017-01-18 09:16:36 +01:00
Francois-Xavier Le Bail
11d3a01319 Move the printer summaries from INSTALL.txt to each printer
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
2016-08-14 17:03:43 +02:00
Guy Harris
e40b5d4303 Consistently use tabs for indentation. 2015-12-21 20:28:09 -08:00
Francois-Xavier Le Bail
99c91c3aec Rename 'tcpdump-stdinc.h' to 'netdissect-stdinc.h'
Get the full log via: git log --follow netdissect-stdinc.h
2015-09-10 08:50:40 +02:00
Francois-Xavier Le Bail
c1c3c77463 Printers must include 'netdissect.h', not 'interface.h' 2015-09-05 23:35:58 +02:00
Denis Ovsienko
0938876cd1 refine tok2str() buffer use
Switch RRCP and BGP functions from tok2strbuf() to tok2str() to avoid
unnecessary local buffer management. The latter function does it in a
way to allow up to 4 calls to itself from printf(). After that
tok2strbuf() remains used by tok2str() only and can be refined later.

Remove a duplicate macro and place the remaining definition into the
right file.
2015-06-29 15:53:56 +01:00
Denis Ovsienko
38700c7f24 dismiss NETDISSECT_REWORKED macro
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.
2015-03-22 10:06:15 +00:00
Guy Harris
ed85e20e4d u_intN_t is dead, long live uintN_t.
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.
2014-04-23 00:20:40 -07:00
Guy Harris
1cde6435df Netdissectify the to-name resolution routines.
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.
2014-04-04 00:43:46 -07:00
Denis Ovsienko
1fe6e66ece make use of NETDISSECT_REWORKED
Update the already converted decoders to define the macro and to include
interface.h instead of netdissect.h. Fix incurred compile errors.
2014-03-15 14:19:49 +04:00
Denis Ovsienko
569a6d8fe8 RRCP: don't include unneeded headers 2014-03-12 12:57:31 +04:00
Denis Ovsienko
22577b0da4 RRCP: remove extra return 2014-02-10 14:19:04 +04: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
Denis Ovsienko
77b0218699 remove two needless macros
ETH_ALEN in print-rrcp.c was unused. OFP_ETH_ALEN in
print-openflow-1.0.c was a reinvention of ETHER_ADDR_LEN.
2013-11-26 18:45:33 +04:00
Guy Harris
4417061385 0x%02d is silly - 0x means "hex", so it should be 0x%02x.
Found by Xavier Heiny.
2012-06-08 10:14:14 -07:00
Andrew Nording
bcfc120d7a Fix endianness of some parameters.
Reviewed-By: Guy Harris <guy@alum.mit.edu>
2011-04-28 12:38:55 -07:00
Guy Harris
359c312cc6 Use tok2strbuf() rather than doing it by hand (with potentially-unsafe
routines).  Thanks and a tip of the Hatlo hat to OpenBSD's linker for
warning about that.
2009-10-11 12:49:05 -07:00
Guy Harris
83236cce65 Add __attribute__((format)) to the declarations of the ndo_printf,
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.
2009-05-24 14:06:10 -07:00
gianluca
44b03896e9 Use u_intXX_t instead of uintXX_t, because the fomer ones are the ones that
we check in the configure script and *nix and the ones we define under Windows
(windump).
2008-04-11 17:21:34 +00:00
guy
1789f57c36 From Andrew Silent: Realtek Remote Control Protocol support (see
OpenRRCP.org.ru for details).
2008-02-06 10:47:53 +00:00