]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-bfd.c
Makefile.in: don't remove configure and config.h.in in make distclean.
[tcpdump] / print-bfd.c
index cb0dcb26be387d245d7d39d787ee69a4bc733bc3..fbead9dbd274370eac76f81d4698389fbcd80cb5 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "netdissect-stdinc.h"
 
+#define ND_LONGJMP_FROM_TCHECK
 #include "netdissect.h"
 #include "extract.h"
 
@@ -145,7 +146,8 @@ static const struct tok bfd_diag_values[] = {
 static const struct tok bfd_port_values[] = {
     { BFD_CONTROL_PORT,  "Control" },
     { BFD_MULTIHOP_PORT, "Multihop" },
-    { BFD_LAG_PORT,      "Lag" },
+    { BFD_LAG_PORT,      "LAG" },
+    { SBFD_PORT,         "S-BFD" },
     { 0, NULL }
 };
 
@@ -181,7 +183,7 @@ static const struct tok bfd_v1_state_values[] = {
     { 0, NULL }
 };
 
-static int
+static void
 auth_print(netdissect_options *ndo, const u_char *pptr)
 {
         const struct bfd_auth_header_t *bfd_auth_header;
@@ -221,9 +223,7 @@ auth_print(netdissect_options *ndo, const u_char *pptr)
                 pptr++;
                 ND_PRINT(", Password: ");
                 /* the length is equal to the password length plus three */
-                if (nd_printn(ndo, pptr, auth_len - 3,
-                              ndo->ndo_snapend))
-                    goto trunc;
+                nd_printjn(ndo, pptr, auth_len - 3);
                 break;
             case AUTH_MD5:
             case AUTH_MET_MD5:
@@ -248,7 +248,6 @@ auth_print(netdissect_options *ndo, const u_char *pptr)
                     break;
                 }
                 pptr += 2;
-                ND_TCHECK_4(pptr);
                 ND_PRINT(", Sequence Number: 0x%08x", GET_BE_U_4(pptr));
                 pptr += 4;
                 ND_TCHECK_LEN(pptr, AUTH_MD5_HASH_LEN);
@@ -279,7 +278,6 @@ auth_print(netdissect_options *ndo, const u_char *pptr)
                     break;
                 }
                 pptr += 2;
-                ND_TCHECK_4(pptr);
                 ND_PRINT(", Sequence Number: 0x%08x", GET_BE_U_4(pptr));
                 pptr += 4;
                 ND_TCHECK_LEN(pptr, AUTH_SHA1_HASH_LEN);
@@ -288,10 +286,6 @@ auth_print(netdissect_options *ndo, const u_char *pptr)
                     ND_PRINT("%02x", GET_U_1(pptr + i));
                 break;
         }
-        return 0;
-
-trunc:
-        return 1;
 }
 
 void
@@ -301,7 +295,8 @@ bfd_print(netdissect_options *ndo, const u_char *pptr,
        ndo->ndo_protocol = "bfd";
         if (port == BFD_CONTROL_PORT ||
             port == BFD_MULTIHOP_PORT ||
-            port == BFD_LAG_PORT) {
+            port == BFD_LAG_PORT ||
+            port == SBFD_PORT) {
             /*
              * Control packet.
              */
@@ -352,8 +347,7 @@ bfd_print(netdissect_options *ndo, const u_char *pptr,
                          GET_BE_U_4(bfd_header->required_min_echo_interval)/1000);
 
                 if (flags & BFD_FLAG_AUTH) {
-                    if (auth_print(ndo, pptr))
-                        goto trunc;
+                    auth_print(ndo, pptr);
                 }
                 break;
 
@@ -395,8 +389,7 @@ bfd_print(netdissect_options *ndo, const u_char *pptr,
                          GET_BE_U_4(bfd_header->required_min_echo_interval)/1000);
 
                 if (flags & BFD_FLAG_AUTH) {
-                    if (auth_print(ndo, pptr))
-                        goto trunc;
+                    auth_print(ndo, pptr);
                 }
                 break;
 
@@ -432,8 +425,4 @@ bfd_print(netdissect_options *ndo, const u_char *pptr,
                             return;
             }
         }
-        return;
-
-trunc:
-        nd_print_trunc(ndo);
 }