]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-eap.c
Update .gitignore for other configurations
[tcpdump] / print-eap.c
index de59374b03cc351f0157c02b062a614513529602..0dcf7e0bfcb3f860d00a73c085b95d5e81c4ad53 100644 (file)
@@ -21,7 +21,7 @@
 /* \summary: Extensible Authentication Protocol (EAP) printer */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
 #include "netdissect-stdinc.h"
@@ -156,28 +156,22 @@ eap_print(netdissect_options *ndo,
     u_int eap_type, tlen, type, subtype;
     int count=0, len;
 
+    ndo->ndo_protocol = "eap";
     tptr = cp;
     tlen = length;
     eap = (const struct eap_frame_t *)cp;
     ND_TCHECK_SIZE(eap);
     eap_type = EXTRACT_U_1(eap->type);
 
-    /* in non-verbose mode just lets print the basic info */
-    if (ndo->ndo_vflag < 1) {
-       ND_PRINT("%s (%u) v%u, len %u",
-               tok2str(eap_frame_type_values, "unknown", eap_type),
-               eap_type,
-               EXTRACT_U_1(eap->version),
-               EXTRACT_BE_U_2(eap->length));
-       return;
-    }
-
     ND_PRINT("%s (%u) v%u, len %u",
            tok2str(eap_frame_type_values, "unknown", eap_type),
            eap_type,
            EXTRACT_U_1(eap->version),
            EXTRACT_BE_U_2(eap->length));
 
+    if (ndo->ndo_vflag < 1)
+        return;
+
     tptr += sizeof(struct eap_frame_t);
     tlen -= sizeof(struct eap_frame_t);
 
@@ -195,7 +189,8 @@ eap_print(netdissect_options *ndo,
 
         ND_TCHECK_LEN(tptr, len);
 
-        if (type <= 2) { /* For EAP_REQUEST and EAP_RESPONSE only */
+        if (type == EAP_REQUEST || type == EAP_RESPONSE) {
+            /* RFC 3748 Section 4.1 */
             ND_TCHECK_1(tptr + 4);
             subtype = EXTRACT_U_1(tptr + 4);
             ND_PRINT("\n\t\t Type %s (%u)",
@@ -206,14 +201,14 @@ eap_print(netdissect_options *ndo,
             case EAP_TYPE_IDENTITY:
                 if (len - 5 > 0) {
                     ND_PRINT(", Identity: ");
-                    safeputs(ndo, tptr + 5, len - 5);
+                    (void)nd_printzp(ndo, tptr + 5, len - 5, NULL);
                 }
                 break;
 
             case EAP_TYPE_NOTIFICATION:
                 if (len - 5 > 0) {
                     ND_PRINT(", Notification: ");
-                    safeputs(ndo, tptr + 5, len - 5);
+                    (void)nd_printzp(ndo, tptr + 5, len - 5, NULL);
                 }
                 break;
 
@@ -295,11 +290,5 @@ eap_print(netdissect_options *ndo,
     return;
 
  trunc:
-    ND_PRINT("\n\t[|EAP]");
+    nd_print_trunc(ndo);
 }
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * End:
- */