Commit Graph

20 Commits

Author SHA1 Message Date
Francois-Xavier Le Bail
07dfc4e1c4 OLSR: fix "Unchecked return value" found by Coverity
The bounds check is already done before by ND_TCHECK2(*msg_data, addr_size +
name_entry_len + name_entry_padding).
So we are deliberately ignoring the return values of fn_printn with last
argument NULL (no bounds check).
2014-12-08 22:18:16 +01:00
Guy Harris
4038f83ebf Do more bounds checking and length checking.
Don't run past the end of the captured data, and don't run past the end
of the packet (i.e., don't make the length variable go negative).

Also, stop dissecting if the message length isn't valid.
2014-11-11 16:49:39 -08:00
Denis Ovsienko
f0f2e6d058 don't reinvent ND_TCHECK2() 2014-06-12 14:59:03 +04: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
Denis Ovsienko
24598ce6b7 NDOize the rest of util.c 2014-04-14 10:53:46 +04: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
Gisle Vanem
a8ace2868c OLSR: work around MSVC preprocessor (re 48d8b05) 2014-04-03 09:35:14 +04:00
Denis Ovsienko
779bcfb73a convert some stray printf()'s 2014-04-02 18:55:50 +04:00
Denis Ovsienko
62a5184ed4 NDOize ForCES, MPLS LSP ping and OLSR decoders 2014-03-27 14:58:23 +04:00
Denis Ovsienko
ec3761518b justify MIN()/min() further (complements dbfdf97) 2014-03-15 23:31:48 +04:00
Michael Richardson
ac910c086e ndo-ize print-ascii: hex_print_with_offset() 2014-01-01 21:31:18 -05:00
Denis Ovsienko
7de355927b justify declarations of struct tok arrays
Make sure all of them are declared const and most of them -- static.
Proper declaration of token arrays is a common review point for new code
that is based on existing decoders. Thus fix the issue at its root.
2013-09-24 20:54:03 +04:00
Guy Harris
429c8b46ee Fix up length checking for the MID message to check before *each*
interface address, not just the *first* interface address.

For the name service message:

	add length checking, both against truncated packets and bogus
	lengths;

	use fn_printn to print the name, to protect against control
	characters, etc. in the name.
2009-06-28 12:16:43 -07:00
Guy Harris
57bc7f6ef5 Just use u_int, even for values that fit in 16 bits; that squelches a
(irrelevant, but true for the way C works) signed vs. unsigned
comparison warning.  It also probably produces better machine code.
2009-05-21 10:48:19 -07:00
Florian Forster
289e0aed7d print-olsr: Add basic IPv6 support.
Unfortunately OLSR uses the same IDs for IPv4 and IPv6 packets, even
though the size of "messages" differ. The version of the internet protocol
is therefore handed to the "olsr_print" function.

The code isn't very nice, due to a high density of #ifdef INET6'es. If
IPv6-support really should be optional, I'm afraid this is inevitable.
Both, compilation with and without IPv6 support has been tested.

The patch addresses fixes other issues, too. The length given in the packet
was used for pointer arithmetic without checking if the value was in a
reasonable range first in several places. It should now be possible to
decode more than one "namespace message" within a single packet. Other
changes remove trailing whitespace or fix lines indented with tabs (the
majority of the file is indented using spaces).

Signed-off-by: Florian Forster <octo@leeloo.lan.home.verplant.org>
2009-05-21 10:38:40 -07:00
Guy Harris
b0dc4a55ea Get rid of trailing whitespace. 2009-05-21 10:14:22 -07:00
Florian Forster
efb465c5a8 print-olsr: Don't trust the package payload.
Especially not to do pointer arithmetic.

This is a real problem even without malicious people around if you use
OLSR via IPv6, because the message IDs didn't change but addresses are
now longer than four bytes.

Signed-off-by: Florian Forster <octo@leeloo.lan.home.verplant.org>
2009-05-21 10:09:45 -07:00
hannes
c695e7fee4 add support for the nameservice plugin messages generated by www.olsr.org 2008-08-16 11:23:09 +00:00
hannes
1716c03cd7 add support for printing of tc,tc-lq,hello,hna and mid messages 2007-03-28 07:34:55 +00:00
hannes
cb08bf9e3e add basic skeleton for printing olsr packets as per rfc3626
add a line break in verbose mode fro the ip printer.
2007-03-27 10:44:09 +00:00