]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-lspping.c
Do the dump file Capsicum stuff in a common routine.
[tcpdump] / print-lspping.c
index d745700a7f4f3a6684e677e0a16f8e35320a97f7..888adfafbcdc8bf17c517359de44eff242d15519 100644 (file)
@@ -458,8 +458,8 @@ static const struct tok lspping_tlv_downstream_addr_values[] = {
 
 void
 lspping_print(netdissect_options *ndo,
-              register const u_char *pptr, register u_int len) {
-
+              register const u_char *pptr, register u_int len)
+{
     const struct lspping_common_header *lspping_com_header;
     const struct lspping_tlv_header *lspping_tlv_header;
     const struct lspping_tlv_header *lspping_subtlv_header;
@@ -568,8 +568,7 @@ lspping_print(netdissect_options *ndo,
     while(tlen>(int)sizeof(struct lspping_tlv_header)) {
 
         /* did we capture enough for fully decoding the tlv header ? */
-        if (!ND_TTEST2(*tptr, sizeof(struct lspping_tlv_header)))
-            goto trunc;
+        ND_TCHECK2(*tptr, sizeof(struct lspping_tlv_header));
 
         lspping_tlv_header = (const struct lspping_tlv_header *)tptr;
         lspping_tlv_type=EXTRACT_16BITS(lspping_tlv_header->type);
@@ -595,8 +594,7 @@ lspping_print(netdissect_options *ndo,
         tlv_tlen=lspping_tlv_len; /* header not included -> no adjustment */
 
         /* did we capture enough for fully decoding the tlv ? */
-        if (!ND_TTEST2(*tptr, lspping_tlv_len))
-            goto trunc;
+        ND_TCHECK2(*tptr, lspping_tlv_len);
         tlv_hexdump=FALSE;
 
         switch(lspping_tlv_type) {
@@ -604,8 +602,7 @@ lspping_print(netdissect_options *ndo,
             while(tlv_tlen>(int)sizeof(struct lspping_tlv_header)) {
 
                 /* did we capture enough for fully decoding the subtlv header ? */
-                if (!ND_TTEST2(*tptr, sizeof(struct lspping_tlv_header)))
-                    goto trunc;
+                ND_TCHECK2(*tptr, sizeof(struct lspping_tlv_header));
                 subtlv_hexdump=FALSE;
 
                 lspping_subtlv_header = (const struct lspping_tlv_header *)tlv_tptr;
@@ -771,7 +768,7 @@ lspping_print(netdissect_options *ndo,
 
         case LSPPING_TLV_DOWNSTREAM_MAPPING:
             /* that strange thing with the downstream map TLV is that until now
-             * we do not know if its IPv4 or IPv6 , after we found the adress-type
+             * we do not know if its IPv4 or IPv6 , after we found the address-type
              * lets recast the tlv_tptr and move on */
 
             tlv_ptr.lspping_tlv_downstream_map_ipv4= \
@@ -837,8 +834,7 @@ lspping_print(netdissect_options *ndo,
 
         case LSPPING_TLV_BFD_DISCRIMINATOR:
             tptr += sizeof(struct lspping_tlv_header);
-            if (!ND_TTEST2(*tptr, LSPPING_TLV_BFD_DISCRIMINATOR_LEN))
-                goto trunc;
+            ND_TCHECK2(*tptr, LSPPING_TLV_BFD_DISCRIMINATOR_LEN);
             ND_PRINT((ndo, "\n\t    BFD Discriminator 0x%08x", EXTRACT_32BITS(tptr)));
             break;
 
@@ -846,8 +842,7 @@ lspping_print(netdissect_options *ndo,
         {
             uint32_t vendor_id;
 
-            if (!ND_TTEST2(*tptr, LSPPING_TLV_VENDOR_ENTERPRISE_LEN))
-                goto trunc;
+            ND_TCHECK2(*tptr, LSPPING_TLV_VENDOR_ENTERPRISE_LEN);
             vendor_id = EXTRACT_32BITS(tlv_tptr);
             ND_PRINT((ndo, "\n\t    Vendor: %s (0x%04x)",
                    tok2str(smi_values, "Unknown", vendor_id),