]> The Tcpdump Group git mirrors - libpcap/commitdiff
Merge pull request #796 from ffainelli/dsa
authorGuy Harris <[email protected]>
Thu, 24 Jan 2019 01:38:18 +0000 (17:38 -0800)
committerGitHub <[email protected]>
Thu, 24 Jan 2019 01:38:18 +0000 (17:38 -0800)
Add support for DSA link-layer types

1  2 
pcap-common.c

diff --combined pcap-common.c
index 84c90e2b278039f84159e8f7e76e27041c6666b7,e2bfbb2f704523dfdf6f4c981a25a70342ba7613..5b45f58d5e9ae5857a54f4e93f6bacee2f4fd940
   */
  #define LINKTYPE_VPP_DISPATCH 280
  
- #define LINKTYPE_MATCHING_MAX 280             /* highest value in the "matching" range */
+ /*
+  * Broadcom Ethernet switches (ROBO switch) 4 bytes proprietary tagging format.
+  */
+ #define LINKTYPE_DSA_TAG_BRCM 281
+ #define LINKTYPE_DSA_TAG_BRCM_PREPEND 282
+ #define LINKTYPE_MATCHING_MAX 282             /* highest value in the "matching" range */
  
  /*
   * The DLT_ and LINKTYPE_ values in the "matching" range should be the
@@@ -1300,30 -1306,18 +1306,30 @@@ linktype_to_dlt(int linktype
  /*
   * Return the maximum snapshot length for a given DLT_ value.
   *
 - * For most link-layer types, we use MAXIMUM_SNAPLEN, but for DLT_DBUS,
 - * the maximum is 134217728, as per
 + * For most link-layer types, we use MAXIMUM_SNAPLEN.
 + *
 + * For DLT_DBUS, the maximum is 134217728, as per
   *
   *    https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages
 + *
 + * For DLT_EBHSCR, the maximum is 8MB, as per
 + *
 + *    https://www.elektrobit.com/ebhscr
   */
  u_int
  max_snaplen_for_dlt(int dlt)
  {
 -      if (dlt == DLT_DBUS)
 +      switch (dlt) {
 +
 +      case DLT_DBUS:
                return 134217728;
 -      else
 +
 +      case DLT_EBHSCR:
 +              return 8*1024*1024;
 +
 +      default:
                return MAXIMUM_SNAPLEN;
 +      }
  }
  
  /*