Commit Graph

8 Commits

Author SHA1 Message Date
Francois-Xavier Le Bail
0c93b15d38 Rework "Update more link-layer dissectors to void functions"
It's a follow-up to commit 81dbf4a0b0.

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.
2020-08-06 22:36:16 +02:00
Francois-Xavier Le Bail
81dbf4a0b0 Update more link-layer dissectors to void functions
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.
2020-07-15 09:18:35 +02:00
Francois-Xavier Le Bail
19a7707e79 Ethernet: Rename a printer
Rename ether_print_switch_tag() to ether_switch_tag_print(), with _print
suffix like in most similar cases.
2020-03-08 12:36:46 +01:00
Francois-Xavier Le Bail
20eab47a4d Fix trailing spaces 2019-05-23 11:16:47 +02:00
Guy Harris
b258556bb8 Handle switch tags more cleanly.
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.
2019-04-23 15:26:02 -07:00
Guy Harris
1b30fb060a Clean up the switch-tagged header code.
Use MAC_ADDR_LEN in expressions representing offsets and lengths.

Don't declare the Ethernet header structure ourselves in the Broadcom
code, just print it the same way it's printed in the Marvell code.  Make
the two routines similar in other places as well.

Use "Unknown" rather than "unregistered" when printing the Ethernet type
field in the EDSA header - the value may well be registered even if it's
not in ethertype_values, it's just not a value we happen to have in that
table.
2019-04-20 03:17:03 -07:00
Guy Harris
59c57f40fe Use GET macros to fetch packet data. 2019-04-16 11:43:45 -07:00
Vivien Didelot
43b5720499 Add support for decoding Marvell (E)DSA tags
Similarly to commit 6eaebfe adding support for the Broadcom tagging
format supported by the DSA kernel subsystem, this commit adds support
for the Marvell DSA and Ethertype DSA (EDSA) tagging formats.

Marvell DSA is a 4-byte proprietary tag placed between the ether source
address and the ether length/type. It contains data such as the switch
device and port IDs from which a frame came from, or to which port
a frame is targetting. It also contains additional FPri and IEEE bits.

EDSA is a 8-byte variant including a programmable ethertype, two null
bytes and a standard DSA tag.
2019-04-16 12:19:38 -04:00