Commit Graph

3806 Commits

Author SHA1 Message Date
Francois-Xavier Le Bail
ce1470b1ac Update test output for the previous change 2015-05-19 20:25:16 +02:00
Hannes Gredler
be03cc0b4a add support for IS-IS Purge Originator Identifier as per RFC6232. 2015-05-19 15:49:40 +02:00
Guy Harris
032642d666 Don't assume you have <net/if_pflog.h> if you have <net/pfvar.h>.
Debian/kFreeBSD ships <net/pfvar.h> but not <net/if_pflog.h>.
2015-05-17 10:47:30 -07:00
Francois-Xavier Le Bail
e8cd6c12e3 SFLOW: Fix bounds checking 2015-05-07 17:54:32 +02:00
Francois-Xavier Le Bail
20b011958a RPL: Fix 'Consistency Check' control code 2015-05-05 01:12:00 +02:00
Francois-Xavier Le Bail
2c24bfd00c RPL: Fix suboption print 2015-05-04 23:05:23 +02:00
Francois-Xavier Le Bail
9ba41b4da2 OLSR: Fix indent and comments
Avoid too long lines.
Not all C compilers accept C++/C99 comments by default.
2015-05-04 15:25:54 +02:00
Ferry Huberts
672112b1f4 olsr: add a test to cover a HNA sgw case
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
2015-05-03 17:30:47 +02:00
Ferry Huberts
4b4106c93d olsr: fix printing of smart-gateway HNAs in IPv4
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
2015-05-03 17:30:47 +02:00
Ferry Huberts
d8b204e4e7 olsr: fix 'Advertised networks' count
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
2015-05-03 17:30:47 +02:00
Guy Harris
1332106418 Source and destination addresses were backwards. 2015-05-02 17:19:33 -07:00
Guy Harris
4ce240be65 Remove extraneous white space in the GRE SRE list output. 2015-05-02 15:56:29 -07:00
Guy Harris
87ca2371e1 Don't do IPv6 stuff if INET6 isn't defined. 2015-05-02 13:07:05 -07:00
Guy Harris
9dd6f72a8c Fix checksumming of PIMv2 Register messages.
The checksum only covers the header, not the encapsulated packet, so
only checksum that.  However, if that checksum fails, try checksumming
the entire packet, as, according to RFC 4601, packets with the entire
packet checksummed should also be accepted, for interoperability.
2015-05-02 10:15:42 -07:00
Guy Harris
bce91cc243 Fix one more de-constifying cast. 2015-04-28 10:55:24 -07:00
Guy Harris
115059d61a Fix printouts for unrecognized packet types.
For unrecognized LLC packets, don't print the raw packet if we've been
told to suppress that.

For unrecognized Ethertype packets, print the Ethertype if we haven't
already done so.
2015-04-28 10:50:50 -07:00
Francois-Xavier Le Bail
fd95de87be MEDSA: Address a Coverity warning 2015-04-28 14:36:01 +02:00
Francois-Xavier Le Bail
79bfaef492 netdissect.h: Add a comment on IS_NOT_NEGATIVE macro 2015-04-28 06:17:16 +02:00
Francois-Xavier Le Bail
cab33b7a0a netdissect.h: Update ND_TTEST2 to fix issue 443
Add IS_NOT_NEGATIVE macro.
Avoid these warnings:
- comparison of unsigned expression >= 0 is always true [-Wtype-limits],
- comparison is always true due to limited range of data type [-Wtype-limits].
2015-04-27 18:20:59 +02:00
Guy Harris
599b0311e0 Clean up To DS and From DS checks.
Rewrite get_data_src_dst_mac() to test To DS and From DS only once; that
also more clearly means that there's no way to escape from that function
without setting both pointers, so the compiler doesn't think there's a
way to do so.
2015-04-27 00:02:31 -07:00
Guy Harris
a1fa7a0114 Compile with -Wcast-qual.
That let me find what might have been the bulk of the 579(!) instances
of "Deconst" reported in

    http://www.cl.cam.ac.uk/~dc552/papers/asplos15-memory-safe-c.pdf

and, hopefully, will prevent more from creeping in.

There are some remaining ones - and they represent attempts to overwrite
the packet bytes handed to tcpdump by libpcap, which could well *fail*
with, for example, memory-mapped capture mechanisms!
2015-04-26 18:50:49 -07:00
Guy Harris
dccbbf9a09 Don't cast away warnings for ether_ntohost().
We have a choice between "your OS's header files suck" warnings on HP-UX
and -Wcast-qual warnings on all platforms.  I vote for the former, as
the latter let us find cases where we're casting constness away, and we
really don't want to cast constness away if we can possibly avoid it.
2015-04-26 18:42:23 -07:00
Guy Harris
e3302bc807 Fix misedit. 2015-04-26 18:37:43 -07:00
Guy Harris
9614e9389e Make sure print.h shows up in the release tarball. 2015-04-26 18:04:26 -07:00
Guy Harris
69cb46af91 Fix a bunch of de-constifications. 2015-04-26 17:24:42 -07:00
Guy Harris
4ac279241d Add a comment asking what the heck is going on here.
It's fetching a checksum field directly, rather than with
EXTRACT_16BITS().
2015-04-26 17:17:20 -07:00
Guy Harris
c4ba5098d6 Fix heuristic not to be byte-order-dependent.
I'm *guessing* that the item being fetched is big-endian; the "vt"
protocol might be old enough that they developed it on (non-Sun386i) Sun
workstations, assuming they didn't just say "this is an Internet
protocol, hence fields are big-endian").

That also prevents problems on platforms that don't support unaligned
accesses.
2015-04-26 17:09:16 -07:00
Guy Harris
7ac62c7158 Fetch a 32-bit big-endian quantity with EXTRACT_32BITS().
*Don't* fetch it with a pointer cast and dereference!  That will fail on
little-endian machines and may fail on machines that don't handle
unaligned references.
2015-04-26 17:03:32 -07:00
Guy Harris
78c64db750 Print the formatted IP address, not the raw binary address, as a string. 2015-04-26 15:34:13 -07:00
Francois-Xavier Le Bail
8da466fa75 MEDSA: fix indent 2015-04-25 22:44:15 +02:00
Andrew Lunn
d729eb478e Add support for the Marvell Extended Distributed Switch Architecture header
This header can be used with Marvell switches to direct packets in/out
of a specific port in a tree of interconnected switches. The header
uses its own Ethertype of 0xdada.

By default, only brief output is printed, showing the switch device,
port, and vlan the packet is to/from. However if -e is given, to print
the link-level header, all fields are printed.
2015-04-25 22:44:15 +02:00
Michael Richardson
7b2c5a11a7 Merge branch 'master' of git+ssh://bpf.tcpdump.org/tcpdump/master/git/tcpdump 2015-04-22 16:17:35 -04:00
Guy Harris
30b028f9da Use unsigned values in tok2str and bittok2str routines.
This prevents the compiler issue mentioned in GitHub issue #451, and
also cleans up some other signed vs. unsigned stuff.

While we're at it, clean up bittok2str_internal() (just pass it the
separator string, not a Boolean value that's tested to choose the
separator string), and print unknown arguments to the bittok2str
routines in hex, not decimal.
2015-04-18 19:56:49 -07:00
Guy Harris
954bf4e2e3 Fix comment. 2015-04-18 16:22:23 -07:00
Guy Harris
933dc24d09 Fix -e output for FDDI, Token Ring, and IP-over-Fibre Channel.
Print them the same way other headers are printed ("src > dst, length l").

For FDDI, always print the frame control field symbolically

For Token Ring, print the AC and FC fields unless the -q flag was given,
just as we do for the FC field for FDDI.
2015-04-18 12:54:57 -07:00
Guy Harris
5c2fc51b16 Print src > dst, not dst > src.
The addresses were printed in the wrong order.
2015-04-18 12:43:30 -07:00
Guy Harris
9d146b98d7 Skip the LLC header after printing information for it.
No effect on behavior, but looks a bit nicer.
2015-04-18 10:51:17 -07:00
Guy Harris
5170957d27 With -e, print the LLC header before the SNAP header; without it, cut the SNAP header.
With -e, write out everything; without -e, just write the SNAP header
and, if the OUI is 000000, don't report it, and report the PID as an
ethertype.
2015-04-18 00:08:52 -07:00
Guy Harris
bd00116d80 Skip the LLC and SNAP headers with -x.
Have llc_print() return the length of the LLC header, plus the length of
the SNAP header, if available - or, if it couldn't dissect the payload,
return the *negative* of that sum.  Use that return value in link-layer
printers.
2015-04-17 23:42:22 -07:00
Guy Harris
cd81326386 Fix the printing of RFC 948-style IP packets.
They have a 3-octet LLC UI frame followed *immediately* by an IP packet;
the payload is 3 bytes, not 4 bytes, past the LLC header.
2015-04-17 19:47:29 -07:00
Guy Harris
2c5e14ceac Get rid of unused variables. 2015-04-17 19:14:47 -07:00
Guy Harris
7f664c43c7 Update test output for the previous change. 2015-04-17 19:01:14 -07:00
Guy Harris
59864b113d Clean up printing of LLC packets.
Don't print LLC header information for SNAP packets; if we have a SNAP
header, just call snap_print() and return its return value, regardless
of whether it's 1 or 0, don't fall into the code to print raw LLC header
information - and don't print it with -e, either.

If llc_print() returns 0, just call the default packet printer, don't
print the MAC-layer header or the extracted ethertype - llc_print() will
print the source and destination MAC addresses and whatever type
information is in the LLC or SNAP headers.

If we don't know the DSAP/LSAP, and it's an information frame (numbered
or not) and not an XID frame, return 0, so that we give a hex dump of
the raw payload.

In addition, print the length when printing SNAP header information with
-e.
2015-04-17 18:38:46 -07:00
Guy Harris
ce0f6c9687 Extract addresses for management frames in a separate routine. 2015-04-17 13:49:12 -07:00
Guy Harris
698e658e27 Check the Protected bit for management frames, too.
Management frames can have the Protected bit set; if so, just use
wep_print() on the body.
2015-04-17 13:22:16 -07:00
Guy Harris
5d11d5212a Update test output to reflect previous change. 2015-04-17 13:14:22 -07:00
Guy Harris
86518728ca Don't announce protected data frames if -e isn't set.
wep_print()s output should indicate that the frame is protected; no need
to stick "Protected" into the output.
2015-04-17 12:36:41 -07:00
Guy Harris
8275fd8117 The FC flag is now "protected", not "WEP".
It's also used for WPA/WPA2, so it's a generic "protected by encryption"
flag.  Update the name of the macro that checks it, and report it as
"Protected" rather than "WEP Encrypted".
2015-04-15 20:11:41 -07:00
Guy Harris
102922077b Reflect the results of recent changes.
We don't print anything from the MAC header without -e, even with -v -
except for the Protected flag, which we print regardless of -e or -v.
2015-04-15 20:07:52 -07:00
Guy Harris
1ac906f174 Handle the link-layer header more like other 802.x dissectors.
Have ieee_802_11_hdr_print() unconditionally print the MAC header, call
it before any payload dissection if -e is specified, call it if
llc_print() fails and -e *isn't* specified, and print "WEP Encrypted"
for protected management and control frames if -e isn't specified.

Pull the extraction of source and destination addresses out of
ieee_802_11_hdr_print(), and do it only for data frames, as it's not
needed for management or control frames.
2015-04-15 19:44:34 -07:00