Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions gencode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1747,6 +1747,13 @@ init_linktype(compiler_state_t *cstate, pcap_t *p)
cstate->off_nl_nosnap = 3; /* 802.3+802.2 */
break;

case DLT_DSA_TAG_GSW1XX:
cstate->off_linktype.constant_part = 20;
cstate->off_linkpl.constant_part = 22; /* Ethernet header length + Special Tag Length */
cstate->off_nl = 0; /* Ethernet II */
cstate->off_nl_nosnap = 3; /* 802.3+802.2 */
break;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Packet filtering is a bit more complicated than that (see #1195), but it does not have to be implemented right at the start. I suggest to attempt filtering as one of the next steps.

case DLT_SLIP:
/*
* SLIP doesn't have a link level type. The 16 byte
Expand Down Expand Up @@ -3730,6 +3737,7 @@ gen_linktype(compiler_state_t *cstate, bpf_u_int32 ll_proto)
case DLT_NETANALYZER_TRANSPARENT:
case DLT_DSA_TAG_BRCM:
case DLT_DSA_TAG_DSA:
case DLT_DSA_TAG_GSW1XX:
/* Geneve has an EtherType regardless of whether there is an
* L2 header. VXLAN always has an EtherType. */
if (!cstate->is_encap)
Expand Down
3 changes: 2 additions & 1 deletion pcap-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1311,8 +1311,9 @@

// See DLT_DEBUG_ONLY
#define LINKTYPE_DEBUG_ONLY 303
#define LINKTYPE_DSA_TAG_GSW1XX 304

#define LINKTYPE_HIGH_MATCHING_MAX 303 /* highest value in the "matching" range */
#define LINKTYPE_HIGH_MATCHING_MAX 304 /* highest value in the "matching" range */

/*
* The DLT_ and LINKTYPE_ values in the "matching" range should be the
Expand Down
5 changes: 5 additions & 0 deletions pcap-linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -5688,6 +5688,11 @@ static struct dsa_proto {
* https://elixir.bootlin.com/linux/v6.13.2/source/net/dsa/tag_xrs700x.c
*/
{ "xrs700x", DLT_DEBUG_ONLY },
/*
* Type 2, with EtherType 0x88C3 Infineon/Lantiq/Intel/Maxlinear.
*
*/
{ "gsw1xx", DLT_DSA_TAG_GSW1XX },
};

/*
Expand Down
7 changes: 6 additions & 1 deletion pcap/dlt.h
Original file line number Diff line number Diff line change
Expand Up @@ -1687,6 +1687,11 @@
* direction, any protocol or any data integrity/consistency whatsoever.
*/
#define DLT_DEBUG_ONLY 303
/*
* MaxLinear DSA ethernet switch protocol.
* Requested by Peter Enderborg <[email protected]>.
*/
#define DLT_DSA_TAG_GSW1XX 304

/*
* In case the code that includes this file (directly or indirectly)
Expand All @@ -1699,6 +1704,6 @@
#undef DLT_HIGH_MATCHING_MAX
#endif

#define DLT_HIGH_MATCHING_MAX 303 /* highest value in the "matching" range */
#define DLT_HIGH_MATCHING_MAX 304 /* highest value in the "matching" range */

#endif /* !defined(lib_pcap_dlt_h) */