+ while (length_type == ETHERTYPE_8021Q ||
+ length_type == ETHERTYPE_8021Q9100 ||
+ length_type == ETHERTYPE_8021Q9200 ||
+ length_type == ETHERTYPE_8021QinQ) {
+ /*
+ * It has a VLAN tag.
+ * Print VLAN information, and then go back and process
+ * the enclosed type field.
+ */
+ if (caplen < 4) {
+ ndo->ndo_protocol = "vlan";
+ nd_print_trunc(ndo);
+ return hdrlen + caplen;
+ }
+ if (length < 4) {
+ ndo->ndo_protocol = "vlan";
+ nd_print_trunc(ndo);
+ return hdrlen + length;
+ }
+ if (ndo->ndo_eflag) {
+ uint16_t tag = GET_BE_U_2(p);
+
+ ether_type_print(ndo, length_type);
+ if (!printed_length) {
+ ND_PRINT(", length %u: ", orig_length);
+ printed_length = 1;
+ } else
+ ND_PRINT(", ");
+ ND_PRINT("%s, ", ieee8021q_tci_string(tag));
+ }
+
+ length_type = GET_BE_U_2(p + 2);
+ p += 4;
+ length -= 4;
+ caplen -= 4;
+ hdrlen += 4;
+ }
+
+ /*
+ * We now have the final length/type field.
+ */
+ if (length_type <= MAX_ETHERNET_LENGTH_VAL) {
+ /*
+ * It's a length field, containing the length of the
+ * remaining payload; use it as such, as long as
+ * it's not too large (bigger than the actual payload).
+ */
+ if (length_type < length) {
+ length = length_type;
+ if (caplen > length)
+ caplen = length;
+ }
+
+ /*
+ * Cut off the snapshot length to the end of the
+ * payload.
+ */
+ nd_push_snapend(ndo, p + length);
+
+ if (ndo->ndo_eflag) {
+ ND_PRINT("802.3");
+ if (!printed_length)
+ ND_PRINT(", length %u: ", length);
+ }
+
+ /*
+ * An LLC header follows the length. Print that and
+ * higher layers.
+ */
+ llc_hdrlen = llc_print(ndo, p, length, caplen, &src, &dst);
+ if (llc_hdrlen < 0) {
+ /* packet type not known, print raw packet */
+ if (!ndo->ndo_suppress_default_print)
+ ND_DEFAULTPRINT(p, caplen);
+ llc_hdrlen = -llc_hdrlen;
+ }
+ hdrlen += llc_hdrlen;
+ nd_pop_packet_info(ndo);
+ } else if (length_type == ETHERTYPE_JUMBO) {
+ /*
+ * It's a type field, with the type for Alteon jumbo frames.
+ * See
+ *
+ * https://tools.ietf.org/html/draft-ietf-isis-ext-eth-01
+ *
+ * which indicates that, following the type field,
+ * there's an LLC header and payload.
+ */