Commit Graph

4052 Commits

Author SHA1 Message Date
Guy Harris
1f1e8ecc07 Merge pull request #515 from adarqui/typos
Just fixes a few typos and grammatical issues
2016-04-26 12:05:44 -07:00
Andrew Darqui
d0aeb773c2 Just fixes a few typos and grammatical issues:
- informations/Information
- the the
- usefull/useful
- optionnal/optional
- your/you
2016-04-26 14:43:12 -04:00
Guy Harris
549aab2173 Use strtol(), not atoi(), to parse integral values.
strtol()'s error behavior is standardized; atoi()'s isn't.
2016-04-26 03:04:21 -07:00
Andrew Darqui
fc213645d4 Initial support for the REdis Serialization Protocol known as RESP.
This commit adds support for RESP as defined in: http://redis.io/topics/protocol.
It also supports inline commands and pipelining. Due to the popularity of RESP,
numerous services are emerging that use this protocol. You may decode RESP packets
on arbitrary ports using the "-T resp" option.

Example captures can be found in tests/resp_*.

A simple way to test this parser is to start redis-server and then run
redis-cli commands such as "redis-cli set key value".

Traditionally, redis-cli monitor is used to debug redis. Unfortunately,
the "monitor" command can cause significant load on a redis-server in
production. This parser may be used as a non-invasive alternative to
redis-cli monitor.
2016-04-26 11:00:21 +02:00
Guy Harris
45a212f0a2 Squelch a signed vs. unsigned comparison warning.
uint8_t + int constant = int; make the constant unsigned.
2016-04-13 18:57:09 -07:00
Guy Harris
2398aa233d Get rid of set-but-not-used variable. 2016-04-13 18:54:11 -07:00
Guy Harris
39e332e70d Clean up version test.
!(nfhdr->nflog_version) is equivalent to (nfhdr->nflog_version == 0).

That will evaluate to 1 if nfhdr->nflog_version is 0 and to 0 otherwise.

So !(nfhdr->nflog_version) == 0 is equivalent to nfhdr->nflog_version != 0,
but 1) it's more obvious what it means and 2) compilers don't point out
that it may not mean what you intended.
2016-03-25 12:51:08 -07:00
Guy Harris
3d11d28ba0 Make sure the length of the header is valid.
It must be at least 2, as it includes the lengths of the Base and
Service Path headers, and those are always present.
2016-03-25 12:49:37 -07:00
Francois-Xavier Le Bail
f0b959c53e Restore alphabetical order in Makefile.in and netdissect.h 2016-03-22 17:23:40 +01:00
bugyo
ba8a8cd5a3 Add printing function for Generic Protocol Extension for VXLAN
and Network Service Header.

This code stands for following internet drafts:

- VXLAN GPE: draft-ietf-nvo3-vxlan-gpe-01
- NSH: draft-ietf-sfc-nsh-01
2016-03-22 16:59:03 +01:00
Guy Harris
c66320c670 We have to set the filter on every new file.
Even if we haven't recompiled the filter, because the new file has the
same DLT as the old file, we still need to apply it to the new file.
2016-03-20 15:59:27 -07:00
Guy Harris
321383790f Don't recompile the filter if the new file has the same DLT.
Only recompile the filter - and only find a new printer and a new DLT
name - if, when reading multiple files with the -V flag, the new file
has a different DLT value from the old file.  With lots of small files,
that can make a significant performance difference.

Addresses GitHub issue #508.
2016-03-20 15:23:16 -07:00
Guy Harris
91983fa323 Have one switch statement, not two, for radiotap fields.
Merge the two switch statements.

Use local variables, for each case, for the subfields, while we're at
it.
2016-02-12 22:39:24 -08:00
Guy Harris
83b356e177 Don't overwrite the destination IPv6 address for routing headers.
If we have a routing header, instead of overwriting the packet's IPv6
destination address in the packet with the final destination, so that
the next protocol's checksum routine can use it, we do as we do for
IPv4, and, in the "next protocol checksum" routine, scan the headers
looking for a routing header and, if we find one, copy the final
destination from it.

While we're at it, clean up a few things.
2016-02-12 20:26:39 -08:00
Guy Harris
63d0029e27 Pass an adjusted struct pcap_pkthdr to the sub-printer.
The caplen and len of the packet it's printing must be reduced by the
length of the PPI header.
2016-02-12 18:48:22 -08:00
Guy Harris
cc79646a9d Add some packet-length checks. 2016-02-12 16:14:35 -08:00
Guy Harris
cdda157a88 Fix check against snapshot length. 2016-02-12 14:51:44 -08:00
Francois-Xavier Le Bail
35e410ca1f Add three test cases for already fixed CVEs
CVEs by Steffen Bauch
CVE-2014-8767: OLSR
CVE-2014-8768: Geonet
CVE-2014-8769: AODV
2016-02-06 15:26:14 +01:00
Francois-Xavier Le Bail
20c9007deb VXLAN: Add a bound check
Moreover:
Add and use tstr[].
Add and use VXLAN_HDR_LEN.
2016-01-31 20:52:31 +01:00
Francois-Xavier Le Bail
fdc13e28cf VXLAN: Add a test case 2016-01-31 11:34:39 +01:00
Francois-Xavier Le Bail
f92345ee43 CONTRIBUTING: Update about invalid packets 2016-01-28 16:57:18 +01:00
Francois-Xavier Le Bail
436ced3bd8 Change istr[] (for invalid string) to be global 2016-01-28 14:24:19 +01:00
Guy Harris
5e811a837e Don't do the DDP-over-UDP heuristic check up front.
There's probably less DDP-over-UDP traffic passing through tcpdump these
days than, for example, SNMP v2 traffic from a low source port longer
than 512 bytes, so move the latter heuristic check after all the other
checks.

Fixes GitHub tcpdump issue #499.
2016-01-11 16:14:56 -08:00
Guy Harris
ea1182b7f3 Fix the radiotap printer to handle the special bits correctly.
Process bits 29, 30, and 31 in code that's independent of what namespace
we're in:

  If we're switching to the radiotap namespace, reset the bit numbers to
  start back at 0.

  If we're switching to a vendor namespace, get the vendor OUI and
  subspace, and the skip length.

  Keep trace of which namespace we're in.

  If we're *in* a vendor namespace, skip over the data specified by the
  skip length (and reset it, as we've processed all the vendor namespace
  data and, if there's a subsequent bitmap in the same namespace,
  there's nothing more to process.  Use cpack_align_and_reserve() to
  skip that, so we check that we don't go past the end of the packet
  data.

Fixes GitHub tcpdump issue #498.

This removes some bogus errors; update the test output to reflect that.
2016-01-11 15:47:31 -08:00
Guy Harris
817aadf8bb Use the new debugging routines in libpcap.
Newer versions of libpcap, when configured to provide debugging
printouts for the filter expression parser or optimizer, provide
routines to set the "debug the parser" and "debug the optimizer" flags;
use them if the library has them.  If the library doesn't have them, do
our best to try to use the older mechanisms for requesting debugging, if
present.
2015-12-30 18:49:37 -08:00
Denis Ovsienko
3dbcc57b6a RSVP: squelch a compiler warning
./print-rsvp.c: In function ‘rsvp_print’:
./print-rsvp.c:1870:13: warning: ISO C90 forbids mixed declarations and code [-Wpedantic]
             u_short subplen, subtlen;
             ^
2015-12-28 10:32:57 +00:00
Guy Harris
f521fa526a I suspect an INTEGRITY object in a submessage covers only the submessage.
So don't hand rsvp_obj_print() a pointer to the beginning of, and the
length of, the entire bundle message; hand it a pointer to the beginning
of, and the length of, the submessage.

Use "bundle" rather than "aggregate" as the message type, while we're at
it; to quote RFC 2961, "The term "bundling" is used to avoid confusion
with RSVP reservation aggregation."
2015-12-27 20:13:14 -08:00
Guy Harris
7b1cba646d If HAVE_LIBCRYPTO isn't defined, define a stub signature_verify().
That cleans up its callers.
2015-12-27 18:09:33 -08:00
Guy Harris
c995065620 We no longer need <stdlib.h> as signature_verify() does the allocation now. 2015-12-27 18:00:30 -08:00
Guy Harris
59caec8a01 Have signature_verify() do the copying and clearing.
Just pass it a pointer to a routine to do the clearing and a pointer to
the data that needs to be cleared; signature_verify() will relocate all
pointers to stuff that needs to be cleared to point into the copy, clear
the signature itself, and call the routine to clear anything else.
2015-12-27 17:59:56 -08:00
Guy Harris
20f164f5e4 Don't overwrite packet data when checking the signature.
Instead, make a copy, and overwrite that.
2015-12-27 16:58:52 -08:00
Guy Harris
e40b5d4303 Consistently use tabs for indentation. 2015-12-21 20:28:09 -08:00
Denis Ovsienko
918517e1dd update last modified date in man page(s) 2015-12-17 23:53:36 +00:00
Francois-Xavier Le Bail
38eadee0d0 There is no need to use strdup() for options
The other options don't use it.
2015-12-17 23:21:49 +01:00
Guy Harris
08e40fdbd6 The last 2 bytes of an Ethernet header are the "length/type field".
Call it that, to indicate that it's not necessarily a type field.

While we're at it, get rid of references to "DEC/Intel/Xerox" and
"802.3" Ethernet headers in comments; since 802.3y, the 802.3 standard
supports both "DIX" frames, with a type field, and earlier 802.3 frames,
with a length field, so there's only one version of Ethernet, 802.3,
which supports frames with type fields and frames with length fields.
2015-12-16 21:04:13 -08:00
Francois-Xavier Le Bail
b713410ff2 Ethernet: Print the Length/Type field as length when needed
Reference: IEEE Std 802.3-2012
"If the value of this field is less than or equal to 1500 decimal
(05DC hexadecimal), then the Length/Type field indicates the number
of MAC client data octets contained in the subsequent MAC Client Data
field of the basic frame (Length interpretation)."

Update the output of a test accordingly.
2015-12-16 15:59:39 +01:00
Denis Ovsienko
2b37556bfa Merge pull request #471 from qnet-herwin/radius_port1700 2015-12-16 09:26:40 +00:00
Guy Harris
354638fa02 Do more bounds checking.
Step through the SCTP packet with the bp variable, and keep a packet
data remaining variable and use that for bounds checking.  For each
chunk, keep a chunk data remaining variable and use that as well.  If
there's not enough room for a full item, that gets reported as an error.

While we're at it, fix an error printout.
2015-12-15 19:12:00 -08:00
Francois-Xavier Le Bail
67d45a4b05 Fix some leaks found by Valgrind/Memcheck 2015-12-15 22:15:30 +01:00
Guy Harris
fd2a4d9ad2 Use uintptr_t to look at the bits of a pointer.
We use AC_TYPE_UINTPTR_T in the configure script, so it'll be defined if
we use autotools, and MSVC has supported it since at least Visual Studio
.NET 2003, so we'll use it instead of "unsigned long"; "unsigned long"
causes warnings on LLP64 platforms, as it's not wide enough for a
pointer on those platforms.
2015-12-15 11:22:19 -08:00
Herwin Weststrate
266720f258 Translate UDP/1700 as RADIUS
Used for Cisco CoA/Disconnect, as shown on https://supportforums.cisco.com/discussion/11719766/ise-112-change-authorization-avaya-switches-5520. The RFC says port 3799, but Cisco does this otherwise, which means this is not an officially reserved port for RADIUS.
2015-12-15 18:42:04 +01:00
Francois-Xavier Le Bail
f25ed1f812 Harmonize TCP source or destination ports tests with UDP ones 2015-12-14 20:28:14 +01:00
Guy Harris
18200d6eea Check for fork/vfork failing.
Clean up some other stuff while we're at it.
2015-12-13 14:29:40 -08:00
Guy Harris
6288f924b4 Merge pull request #494 from RomeroMalaquias/master
Avoiding conditional directives that break statements
2015-12-13 14:18:14 -08:00
Romero Malaquias
759f3de8db Avoiding conditional directives that break statements 2015-12-13 18:43:08 -03:00
Francois-Xavier Le Bail
046f10da38 OSPF: Fix a segmentation fault
Moreover:
Fix printout of Link Protection Type sub-TLV.
Add some length checks.
Add and use istr[].
Add some comments.
2015-12-09 15:46:12 +01:00
Francois-Xavier Le Bail
4b870b6496 Add missing output files for MPLS/ICMP extensions capture file
Add the test cases accordingly.
Complete Hannes's commit fad6704f63.
2015-11-27 15:25:35 +01:00
Francois-Xavier Le Bail
921a67c298 UDLD: Fix "Unchecked return value" found by Coverity
The bounds check is already done before by ND_TCHECK2(*tptr, len).
So we are deliberately ignoring the return value of fn_printn with last
argument NULL (no bounds check).
2015-11-26 16:47:14 +01:00
Francois-Xavier Le Bail
4a15e7e839 VTP: Add bounds checks 2015-11-21 14:25:36 +01:00
Francois-Xavier Le Bail
ba983e34ca LISP: Add and use istr[] and tstr[] strings
Update the output of a test accordingly.

Moreover:
Delete extra blank lines.
2015-11-21 10:41:05 +01:00