Check, and use, the supplied packet length in the PPPoE dissector. (It
reflects the actual packet length; snapend reflects the captured packet
length.)
As we're now doing bounds checks with TCHECK, the loop over the tagged
fields doesn't have to check against snapend.
quit as soon as we see IPOPT_EOL;
*don't* quit as soon as we see IPOPT_NOP, just advance to the
next option, if any;
implement "quit" as "return the destination address from the IP
header rather than as "return 0".
Also, return the IP header destination address if we see a
source-routing option with a too-short length.
we also define it as 88, so we can't have
case IPPROTO_IGRP:
case IPPROTO_EIGRP:
in a switch statement.
The current IANA protocol number assignments page lists 9 as "any
private interior gateway (used by Cisco for their IGRP)" and 88 as
"EIGRP" from Cisco, so we define IPPROTO_PIGP as 9 (which matches what
those BSDs do) and IPPROTO_EIGRP as 88 (so we don't bother with
IPPROTO_IGRP at all), and do
case IPPROTO_PIGP:
case IPPROTO_EIGRP:
It's not clear that we should handle both with the same print routine,
however - Cisco IGRP and Cisco EIGRP don't appear to have the same
packet format.
return -1 if they run out of data.
Have the IPv4 and IPv6 dissectors check for non-positive return values
from those routines and quit if they see one.
run past the end of that payload.
Check that the IPv4 total length isn't less than the header length.
Use "%u", not "%d", to print unsigned values.
Properly update "len" in the header-processing loop for IPv6.
Doing so means we can trust the length passed to the TCP and UDP
dissectors when constructing the IPv6 pseudo-header; do so (but fix the
length we pass to the UDP-over-IPv6 checksum routine).
That length is unsigned; make the corresponding arguments to the TCP and
UDP checksum routines unsigned.
appropriately, and that GNUmakefile and the MSVC++ project file define
it apppriately, as we do with libpcap, rather than defining it in
"interface.h".
Undo the rcsid-shuffling and addition of extra #includes, as we no
longer need to arrange that "interface.h" be included before using _U_
in an RCS ID or copyright.
use "_U_" in the definitions of "rcsid[]", to eliminate
complaints about those variables being unused;
move the definitions after the include of "interface.h", or add
an include of "interface.h", so that "_U_" is defined.
Include "config.h" before including "tcpdump-stdinc.h" in
"missing/datalinks.c".
values. Use that rather than private definitions in various files.
Add "gmpls.h" to the list of files in FILES, and add it and "ipfc.h" to
the list of files in INSTALL.
backout some of the v1.118 changes
now we hide frag processing under the
vflag option where we print: id, offset.
plus the (+,DF,res) flags using bittok2string
also decode the rfc3514 "evil" bit to keep the security
guys happy;
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.
unused-parameter problems reported by GCC. Add an _U_ tag to label
parameters as unused if the function is called through a pointer (so
that you can't change its signature by removing parameters) or if there
are unused parameters only because the function isn't complete.
Add some additional bounds checks the necessity for which was revealed
while cleaning up unused-parameter problems.
Make some routines static.
"lcp_print()", defined in "print-lcp.c", isn't called anywhere -
"print-ppp.c" has the code to dissect LCP. Get rid of "print-lcp.c".
From Neil T. Spring: fixes for many of those warnings:
addrtoname.c, configure.in: Linux needs netinet/ether.h for
ether_ntohost
print-*.c: change char *foo = "bar" to const char *foo = "bar"
to appease -Wwrite-strings; should affect no run-time behavior.
print-*.c: make some variables unsigned.
print-bgp.c: plen ('prefix len') is unsigned, no reason to
validate by comparing to zero.
print-cnfp.c, print-rx.c: use intoa, provided by addrtoname,
instead of inet_ntoa.
print-domain.c: unsigned int l; (l=foo()) < 0 is guaranteed to
be false, so check for (u_int)-1, which represents failure,
explicitly.
print-isakmp.c: complete initialization of attrmap objects.
print-lwres.c: "if(x); print foo;" seemed much more likely to be
intended to be "if(x) { print foo; }".
print-smb.c: complete initialization of some structures.
In addition, add some fixes for the signed vs. unsigned comparison
warnings:
extract.h: cast the result of the byte-extraction-and-combining,
as, at least for the 16-bit version, C's integral promotions
will turn "u_int16_t" into "int" if there are other "int"s
nearby.
print-*.c: make some more variables unsigned, or add casts to an
unsigned type of signed values known not to be negative, or add
casts to "int" of unsigned values known to fit in an "int", and
make other changes needed to handle the aforementioned variables
now being unsigned.
print-isakmp.c: clean up the handling of error/status indicators
in notify messages.
print-ppp.c: get rid of a check that an unsigned quantity is >=
0.
print-radius.c: clean up some of the bounds checking.
print-smb.c: extract the word count into a "u_int" to avoid the
aforementioned problems with C's integral promotions.
print-snmp.c: change a check that an unsigned variable is >= 0
to a check that it's != 0.
Also, fix some formats to use "%u" rather than "%d" for unsigned
quantities.
in a packet header and the computed checksum for the data that the
checksum covers, what the checksum field's value should have been.
Use that routine in the IP printer.
purpose of 1.105 was to print the ip header values (len, ttl, tos)
at the beginning of the line (where it belongs to) and not at the end;
it is only displayed using the -v(erbose) options;
the BGP output (where i am working now on) gets much more cleaner now;
added support for Originator_ID, Cluster List Attributes;
reworked BGP Open Message Decoder do decode optional Capabilities;
fixed the NEXTHOP decoder of MP_REACH and MP_UNREACH to honor
NH length based on AFI,SAFI
for fragments other than the first fragment.
Also, for packets whose IP protocols we don't handle ourselves, print
the protocol name if "getprotobynumber()" finds it, otherwise print the
protocol number.
Use const more.
Use EXTRACT_* macros more.
Use TCHECK* more.
Use tok2str() to replace some home-grown workalikes.
smb:
- Get rid of private types, use tcpdump-defined types
- Rename fdata and fdata1 to smb_fdata and smb_fdata1 to avoid conflict
with IRIX library function.