| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
Always call ndo->ndo_error with a memory-allocation error if they fail.
Add WARN_UNUSED_RESULT for compilers that support it, and use it for
those routines, so that any future code that doesn't check for failure
gets a warning.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Have nd_push_buffer() take a snapshot length, not a snapshot end, as
its last argument.
Replace nd_push_snapend() and nd_change_snapend() with nd_push_snaplen()
and nd_change_snaplen(), both of which take a pointer into the packet
buffer and snapshot length relative to that pointer as arguments. Have
those routines check the snapshot length to make sure it's not bigger
than the number of bytes in the packet past the pointer, and silently
ignore the requst if it is.
Using a length rather than a pointer avoids the possibility of the
calculation of the snapshot end overflowing and resulting in a snapshot
end *before* the point in the buffer.
Add a test for this, with a capture file containing an IPv6 packet with
an extremely large "jumbo" packet size.
Revert the "Make sure we don't set the snapend before the beginning of
the packet." changes, as they no longer apply with this change (which
also makes sure we don't set the snapend before the beginning of the
packet).
|
|
|
|
|
|
|
| |
The Ethertype 0x8899 is used by Realtek for several over-the-wire
protocols, as well as for supplying tag information to a host CPU from a
Realtek chip. Add code to handle protocols other than RRCP, although we
don't fully dissect all of them.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ICHECK like Invalid-Check.
Reminder: If the checked expression is true an error message is printed
and a 'goto invalid' is executed.
This change adds the parameter 'operator'.
Before this change, '<' comparison was hard coded.
We can do now:
ND_ICHECK_U(length, <, HEADER_LEN);
ND_ICHECK_U(length, ==, 24);
ND_ICHECK_U(length, !=, 8);
ND_ICHECK_ZU(length, <, sizeof(struct my_struct));
ND_ICHECKMSG_U("message length", msg_tlen, <, 4);
...
(Any comparison operator)
Remark: The change of names from ND_LCHECK*() to ND_ICHECK*() is
because something else than a length(L) can be checked.
Moreover:
Place the 'message' parameter at the beginning of ND_ICHECKMSG_U()
and ND_ICHECKMSG_ZU() paramaters lists.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fix some undefined behaviors at runtime.
The errors were like:
print-ether.c:241:11: runtime error: unsigned integer overflow:
1 - 2 cannot be represented in type 'unsigned int'
print-ether.c:242:11: runtime error: unsigned integer overflow:
1 - 2 cannot be represented in type 'unsigned int'
Moreover:
Fix indentation.
|
|
|
|
|
|
|
|
|
|
|
| |
Add a sanity check: packet length need to be >= capture length
(Like a sanity check in print.c, pretty_print_packet() function)
Remove a now useless test:
Because packet length (length) >= capture length (caplen), when
caplen >= ETHER_HDRLEN + switch_tag_len, length cannot
be < ETHER_HDRLEN + switch_tag_len.
|
|
|
|
| |
This is a follow-up to 7b7b84716e604abd8bd92cee75e6385cab6ce3dc.
|
|
|
|
|
|
|
|
| |
Avoid to have p (current pointer on packet data) > ndo->ndo_snapend
in isoclns_print() in some cases.
Moreover:
Add a "FIXME" comment.
|
|
|
|
|
|
| |
Moreover:
Define ND_LONGJMP_FROM_TCHECK.
Remove 2 ndo_ll_hdr_len increments in truncation cases.
|
|
|
|
|
|
|
|
|
|
| |
It's a follow-up to commit 81dbf4a0b05092760d0ff0cdd48c692e4769ba99.
There is no need to update ether_print(), ether_common_print() and
ether_switch_tag_print() to void functions: back to u_int functions.
There is also no need to add a flag parameter to ether_print(),
ether_common_print() and ether_switch_tag_print(): Remove it.
|
|
|
|
| |
(pull request #864)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
brcm_tag_if_print()
brcm_tag_prepend_if_print()
dsa_if_print()
edsa_if_print()
ether_if_print()
netanalyzer_if_print()
netanalyzer_transparent_if_print()
Update ether_print(), ether_common_print() and ether_switch_tag_print()
to void functions.
Add a flag parameter to ether_print(), ether_common_print() and
ether_switch_tag_print() to increment the link-layer header length field
of the netdissect_options when needed.
The calls use TRUE when the return value of the funtions was used.
The calls with FALSE avoid increments when the calls are nested.
Moreover:
Remove trailing "_if" from some protocol names.
|
|
|
|
|
|
|
| |
If the packet is encrypted or changed, so that we just print the payload
as raw data, and we're not running with -e, print the MAC addresses (if
any) and an indication that it's an 802.11AE packet, followed by the
MACsec header.
|
|
|
|
|
|
| |
If -e isn't specified, and a MACsec packet is encrypted or changed, so
that we don't print the payload, at least report that it's a MACsec
packet.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Print the length early if we're printing the link-layer header.
If the payload is encrypted or otherwise modified, print it out as raw
data.
If the payload is not encrypted or otherwise modified, and we didn't
have a problem printing the header, fetch the type/length field
following the MACsec header, skip past it, and continue, rather than
looping back - there shouldn't be multiple MACsec headers, as far as I
know. (If that's not the case, go back to looping.)
|
|
|
|
|
|
| |
Get rid of code that knows about Ethernet; this is 802.1AE, not 802.3AE.
Get rid o some unused variables.
|
| |
|
| |
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
Rename ether_print_common() to ether_common_print(), with _print
suffix like in most similar cases.
Moreover:
Fix indent.
|
| |
| |
| |
| |
| | |
Rename ether_print_switch_tag() to ether_switch_tag_print(), with _print
suffix like in most similar cases.
|
| |
| |
| |
| |
| |
| | |
This implements "IEEE 802.3/Ethernet" mode as described in annex F of
the PTP standard. This uses the same format packets, but directly over
Ethernet instead of encapsulated in UDP.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Replace more calls to ipaddr_string()/ip6addr_string() with calls to
GET_IPADDR_STRING()/GET_IP6ADDR_STRING() macros performing bounds
checking.
Add similar bounds-checking inline functions and macros to wrap
linkaddr_string(), etheraddr_string(), and isonsap_string() and convert
calls to them to use the macros as well.
Shuffle the inline functions in addrtoname.h around a bit, so that the
inline functions, external declarations, and macros are all in the same
order.
|
| |
| |
| |
| | |
[skip ci]
|
| |
| |
| |
| |
| |
| |
| |
| | |
Rename arista_print_ethertype() to arista_ethertype_print(), with _print
suffix like in most similar cases.
Moreover:
Add a 'summary' comment with the protocol name.
|
| | |
|
| | |
|
| |
| |
| |
| | |
The refactoring in b258556b introduced this minor error.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Have the switch tag dissectors handle *only* the switch tag, not
anything else in the Ethernet header.
Have a routine ether_print_switch_tag() that takes a pointer to a
routine to dissect the switch tag, and a switch tag length, as an
argument, and have a common Ethernet dissection routine called by
ether_print_switch_tag() and by ether_print(), passing a null pointer
for the switch tag dissector and 0 for the switch tag length.
Dissect the switch tag after the MAC addresses, if there's a non-null
switch tag routine dissector pointer.
Clean up the processing logic in the common Ethernet dissection code -
have a loop to process VLAN tags, if any, and, when it's done, handle
frames with a length field, frames with a regular type field, and Alteon
jumbo frames.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If we have an Ethernet packet where the last 2 octets of the header are
a length rather than an Ethernet type, and it's less than the remaining
length of the packet, shorten the length and captured length, update the
snapshot end.
Turn the buffer stack into a "packet information" stack, so that, if we
*do* update the snapshot end, we push the old end onto the stack, and
pop it off as soon as we're done dissecting the Ethernet packet, in case
there's more data in the packet after the Ethernet packet.
Use the stack when we use the IPv4 and IPv6 length fields as well.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
MEDSA (which unofficially stands for Marvell EDSA) relies on the
unregistered 0xDADA ethertype value that was randomly choosen and
currently used by the kernel. But with EDSA this value is programmable,
hence can be changed anytime.
Now that a reliable DLT parser is implemented for both DSA and EDSA
tagged master interfaces, let's get rid for the MEDSA ethertype parser.
|
| |
| |
| |
| |
| | |
Rename ether_print_hdr_len() to ether_hdr_len_print(), with _print
suffix like in most similar cases.
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
The exceptions are currently:
Some EXTRACT_ in print-juniper.c, not used on packet buffer pointer.
An EXTRACT_BE_U_3 in addrtoname.c, not always used on packet buffer
pointer.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A fair number of proprietary Ethernet switch tagging protocols, such as
Broadcom tags for instance, will place their tag between the MAC SA and
the Type/Length field.
Move the body of ether_print() into ether_print_hdr_len() and specify
the Ethernet header length as an argument to that function.
ether_print() calls ether_print_hdr_len() with a standard Ethernet
header lenght of 14 bytes, while other callers could specify an
arbitrary length. We still assume that the first Length/Type field to
parse is located 2 bytes before the end of that Ethernet header length.
This will be used in a subsequent commit to parse Broadcom tags.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This reverts commit b7fff7058282c332ba1d8d236c9864ab21b16adf (partially)
The sanity check in print.c/pretty_print_packet() function, packet length
(length) >= capture length (caplen), apply when the ether_print()
function is called by ether_if_print(), netanalyzer_if_print() or
netanalyzer_transparent_if_print().
But the ether_print() function is called in some other cases, thus not
sure length always >= caplen.
|
| | |
|
| |
| |
| |
| |
| |
| | |
Because packet length (len) >= capture length (caplen).
(see the sanity checks in print.c, pretty_print_packet() function)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| | |
Update the output of some tests accordingly.
|
| | |
|
| |
| |
| |
| |
| | |
Update this field in printer entry functions.
It will be used for some printings.
|
| |
| |
| |
| |
| | |
From 'ep', often used as 'pointer to the end of current packet' to 'ehp'
as Ethernet header pointer.
|
| |
| |
| |
| |
| |
| |
| |
| | |
It was mostly used with large functions.
Moreover:
Put some function definition names at the beginning of line.
Fix a space.
|
| |
| |
| |
| |
| |
| |
| |
| | |
This can prevent bizarre failures if, for example, you've done a
configuration in the top-level source directory, leaving behind one
config.h file, and then do an out-of-tree build in another directory,
with different configuration options. This way, we always pick up the
same config.h, in the build directory.
|
| | |
|
| | |
|
| |
| |
| |
| | |
They don't really add anything.
|
| |
| |
| |
| |
| |
| | |
Let the compiler do the optimizations (or not) based on build options.
Avoid 'value has been optimized out' messages in gdb using '-O0'.
|