- if (llc_print(p, length, caplen, ESRC(ep), EDST(ep),
- &extracted_ether_type) == 0) {
- /* ether_type not known, print raw packet */
- if (!eflag)
- ether_hdr_print((u_char *)ep, length + ETHER_HDRLEN);
-
- if (!suppress_default_print)
- default_print(p, caplen);
+ 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;
+ } else if (length_type == ETHERTYPE_8021Q ||
+ length_type == ETHERTYPE_8021Q9100 ||
+ length_type == ETHERTYPE_8021Q9200 ||
+ length_type == ETHERTYPE_8021QinQ) {
+ /*
+ * Print VLAN information, and then go back and process
+ * the enclosed type field.
+ */
+ if (caplen < 4) {
+ ND_PRINT((ndo, "[|vlan]"));
+ return (hdrlen + caplen);
+ }
+ if (length < 4) {
+ ND_PRINT((ndo, "[|vlan]"));
+ return (hdrlen + length);
+ }
+ if (ndo->ndo_eflag) {
+ uint16_t tag = EXTRACT_16BITS(p);
+
+ ND_PRINT((ndo, "%s, ", ieee8021q_tci_string(tag)));
+ }
+
+ length_type = EXTRACT_16BITS(p + 2);
+ if (ndo->ndo_eflag && length_type > ETHERMTU)
+ ND_PRINT((ndo, "ethertype %s, ", tok2str(ethertype_values,"0x%04x", length_type)));
+ p += 4;
+ length -= 4;
+ caplen -= 4;
+ hdrlen += 4;
+ goto recurse;
+ } else if (length_type == ETHERTYPE_JUMBO) {
+ /*
+ * Alteon jumbo frames.
+ * See
+ *
+ * http://tools.ietf.org/html/draft-ietf-isis-ext-eth-01
+ *
+ * which indicates that, following the type field,
+ * there's an LLC header and payload.
+ */
+ /* Try to print the LLC-layer header & 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;
+ } else {
+ if (ethertype_print(ndo, length_type, p, length, caplen, &src, &dst) == 0) {
+ /* type not known, print raw packet */
+ if (!ndo->ndo_eflag) {
+ if (print_encap_header != NULL)
+ (*print_encap_header)(ndo, encap_header_arg);
+ ether_hdr_print(ndo, (const u_char *)ep, orig_length);
+ }
+
+ if (!ndo->ndo_suppress_default_print)
+ ND_DEFAULTPRINT(p, caplen);