Because packet length (length) >= capture length (caplen), when
caplen >= ETHER_HDRLEN, length >= caplen cannot be < ETHER_HDRLEN.
Same for the other test (length < 4).
(see the sanity checks in print.c, pretty_print_packet() function)
Moreover:
Clean up indentation.
Prior to ARMv6, it didn't support it. ARMv6 supports it, if the "don't
act like ARMv5" bit isn't set in the system control register, but has
another bit in the system control register to cause unaligned accesses
to fault rather than succeed. ARMv7 and later don't have "act like
ARMv5" mode, but still has the "fault on unaligned access" bit.
At least some OSes might set the "fault on unaligned access" bit; if
your OS *doesn't* set it, feel free to modify the #if to check for your
OS and for ARM.
"_if", in function names, is just a convention used for the top-level
routine for a given DLT_ value; it's not part of the protocol name for
the link-layer type.
RFC 4684, sadly, doesn't do a very good job of describing what a "route
target" is. In practice, it appears to be a Route Target extended
community, as per RFC 4360 section 4 "Route Target Community". Those do
*not* have the same format as an RFC 4364 Route Descriptor.
So just take the code to dissect an extended community, put it in a
subroutine, change it to directly print information rather than filling
in a static string buffer (C support for strings is spectacularly bad -
large variable-length objects are hard, let's go shopping!), and call
that routine when dissecting RFC 4684 routing information.
Some platforms define the old V7 routine index() (renamed to strchr() in
System V; the latter name is what's used in ANSI C), and you get
"declaration of 'index' shadows a global declaration" warnings.
Call the variable if_index instead.
Code value 0 is not assigned, and the code block guarded by the if() is
specific to Request (1) and Response (2) only. This change prevents the
printer from decoding some invalid EAP messages as if they were valid.
[skip ci]
Add the "Z" suffix for UTC.
According to the RFC3339:
Z A suffix which, when applied to a time, denotes a UTC
offset of 00:00; often spoken "Zulu" from the ICAO
phonetic alphabet representation of the letter "Z".
Update the output of some tests accordingly.
This is an update to packet header timestamps printing based on
Guy Harris's proposal.
Theses timestamps are outside the 1970-2038 range; This happens on some
fuzzed captures.
This will allow to have the same printing on Windows and UN*X.
Update needed before 2038.
-# is used to indicate which packets differ in how they're dissected,
not to ensure the reproducibility of the output.
We also set TZ to GMT0 to do all time-stamp printing in UTC.
This will avoid some differences when checking in different time zones.
We now run the tests without the '-t' option. This will allow to get
problems/changes in time printing functions.
Update the output of the tests accordingly.
Moreover:
Add the '-#' option to better identify a packet when there is a difference
in output.
Using seconds offset from GMT to local time to compute local time give
errors when printing times outside the same daylight saving time period.
Use the localtime() function for default and -tttt cases.
Use the gmtime() function for -ttt and -ttttt cases.
Rename ts_hmsfrac_print() to ts_date_hmsfrac_print().
Remove some variables now useless.
Update some comments.