- const struct eap_frame_t *eap;
- const u_char *tptr;
- u_int tlen, type, subtype;
- int count=0, len;
-
- tptr = cp;
- tlen = length;
- eap = (const struct eap_frame_t *)cp;
- ND_TCHECK(*eap);
-
- /* in non-verbose mode just lets print the basic info */
- if (ndo->ndo_vflag < 1) {
- ND_PRINT((ndo, "%s (%u) v%u, len %u",
- tok2str(eap_frame_type_values, "unknown", eap->type),
- eap->type,
- eap->version,
- EXTRACT_16BITS(eap->length)));
- return;
+ u_int type, subtype, len;
+ u_int count;
+ const char *sep;
+
+ ndo->ndo_protocol = "eap";
+ type = GET_U_1(cp);
+ len = GET_BE_U_2(cp + 2);
+ if (len != length) {
+ /*
+ * Probably a fragment; in some cases the fragmentation might
+ * not put an EAP header on every packet, if reassembly can
+ * be done without that (e.g., fragmentation to make a message
+ * fit in multiple TLVs in a RADIUS packet).
+ */
+ ND_PRINT("EAP fragment?");
+ return;
+ }
+ ND_PRINT("%s (%u), id %u, len %u",
+ tok2str(eap_code_values, "unknown", type),
+ type,
+ GET_U_1((cp + 1)),
+ len);
+ if (len < 4) {
+ ND_PRINT(" (too short for EAP header)");
+ return;