-#define MACSEC_SECTAG_LEN_NOSCI 6
-#define MACSEC_SECTAG_LEN_SCI 14
-static int
-ieee8021ae_sectag_len(netdissect_options *ndo, const struct macsec_sectag *sectag)
-{
- return (GET_U_1(sectag->tci_an) & MACSEC_TCI_SC) ?
- MACSEC_SECTAG_LEN_SCI :
- MACSEC_SECTAG_LEN_NOSCI;
-}
-
-static int macsec_check_length(netdissect_options *ndo, const struct macsec_sectag *sectag, u_int length, u_int caplen)
-{
- u_int len;
-
- /* we need the full MACsec header in the capture */
- if (caplen < (MACSEC_SECTAG_LEN_NOSCI + 2))
- return 0;
-
- len = ieee8021ae_sectag_len(ndo, sectag);
- if (caplen < (len + 2))
- return 0;
-
- if ((GET_U_1(sectag->short_length) & MACSEC_SL_MASK) != 0) {
- /* original packet must have exact length */
- u_int exact = ETHER_HDRLEN + len + 2 + (GET_U_1(sectag->short_length) & MACSEC_SL_MASK);
- return exact == length;
- } else {
- /* original packet must not be short */
- u_int minlen = ETHER_HDRLEN + len + 2 + 48;
- return length >= minlen;
- }
-
- return 1;
-}