]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ldp.c
Makefile.in: don't remove configure and config.h.in in make distclean.
[tcpdump] / print-ldp.c
index b747fe7da1813af91c6473578ca72ab1e967a3e4..896bc40395fa0225e6b27d005b77202f0f2d5c0a 100644 (file)
@@ -288,11 +288,11 @@ ldp_tlv_print(netdissect_options *ndo,
 
     case LDP_TLV_IPV4_TRANSPORT_ADDR:
         TLV_TCHECK(4);
-        ND_PRINT("\n\t      IPv4 Transport Address: %s", ipaddr_string(ndo, tptr));
+        ND_PRINT("\n\t      IPv4 Transport Address: %s", GET_IPADDR_STRING(tptr));
         break;
     case LDP_TLV_IPV6_TRANSPORT_ADDR:
         TLV_TCHECK(16);
-        ND_PRINT("\n\t      IPv6 Transport Address: %s", ip6addr_string(ndo, tptr));
+        ND_PRINT("\n\t      IPv6 Transport Address: %s", GET_IP6ADDR_STRING(tptr));
         break;
     case LDP_TLV_CONFIG_SEQ_NUMBER:
         TLV_TCHECK(4);
@@ -309,16 +309,14 @@ ldp_tlv_print(netdissect_options *ndo,
         switch (af) {
         case AFNUM_INET:
            while(tlv_tlen >= sizeof(nd_ipv4)) {
-               ND_TCHECK_LEN(tptr, sizeof(nd_ipv4));
-               ND_PRINT(" %s", ipaddr_string(ndo, tptr));
+               ND_PRINT(" %s", GET_IPADDR_STRING(tptr));
                tlv_tlen-=sizeof(nd_ipv4);
                tptr+=sizeof(nd_ipv4);
            }
             break;
         case AFNUM_INET6:
            while(tlv_tlen >= sizeof(nd_ipv6)) {
-               ND_TCHECK_LEN(tptr, sizeof(nd_ipv6));
-               ND_PRINT(" %s", ip6addr_string(ndo, tptr));
+               ND_PRINT(" %s", GET_IP6ADDR_STRING(tptr));
                tlv_tlen-=sizeof(nd_ipv6);
                tptr+=sizeof(nd_ipv6);
            }
@@ -354,8 +352,8 @@ ldp_tlv_print(netdissect_options *ndo,
        case LDP_FEC_PREFIX:
            TLV_TCHECK(2);
            af = GET_BE_U_2(tptr);
-           tptr+=LDP_TLV_ADDRESS_LIST_AFNUM_LEN;
-           tlv_tlen-=LDP_TLV_ADDRESS_LIST_AFNUM_LEN;
+           tptr+=2;
+           tlv_tlen-=2;
            if (af == AFNUM_INET) {
                i=decode_prefix4(ndo, tptr, tlv_tlen, buf, sizeof(buf));
                if (i == -2)
@@ -540,8 +538,7 @@ ldp_tlv_print(netdissect_options *ndo,
     return(tlv_len+4); /* Type & Length fields not included */
 
 trunc:
-    nd_print_trunc(ndo);
-    return 0;
+    nd_trunc_longjmp(ndo);
 
 invalid:
     return(tlv_len+4); /* Type & Length fields not included */
@@ -596,17 +593,17 @@ ldp_pdu_print(netdissect_options *ndo,
     pdu_len = GET_BE_U_2(ldp_com_header->pdu_length);
     if (pdu_len < sizeof(struct ldp_common_header)-4) {
         /* length too short */
-        ND_PRINT("%sLDP, pdu-length: %u (too short, < %u)",
-               (ndo->ndo_vflag < 1) ? "" : "\n\t",
-               pdu_len,
-               (u_int)(sizeof(struct ldp_common_header)-4));
+        ND_PRINT("%sLDP, pdu-length: %u (too short, < %zu)",
+                 (ndo->ndo_vflag < 1) ? "" : "\n\t",
+                 pdu_len,
+                 sizeof(struct ldp_common_header)-4);
         return 0;
     }
 
     /* print the LSR-ID, label-space & length */
     ND_PRINT("%sLDP, Label-Space-ID: %s:%u, pdu-length: %u",
            (ndo->ndo_vflag < 1) ? "" : "\n\t",
-           ipaddr_string(ndo, ldp_com_header->lsr_id),
+           GET_IPADDR_STRING(ldp_com_header->lsr_id),
            GET_BE_U_2(ldp_com_header->label_space),
            pdu_len);
 
@@ -629,13 +626,13 @@ ldp_pdu_print(netdissect_options *ndo,
         if (msg_len < sizeof(struct ldp_msg_header)-4) {
             /* length too short */
             /* FIXME vendor private / experimental check */
-            ND_PRINT("\n\t  %s Message (0x%04x), length: %u (too short, < %u)",
-                   tok2str(ldp_msg_values,
-                           "Unknown",
-                           msg_type),
-                   msg_type,
-                   msg_len,
-                   (u_int)(sizeof(struct ldp_msg_header)-4));
+            ND_PRINT("\n\t  %s Message (0x%04x), length: %u (too short, < %zu)",
+                     tok2str(ldp_msg_values,
+                             "Unknown",
+                             msg_type),
+                     msg_type,
+                     msg_len,
+                     sizeof(struct ldp_msg_header)-4);
             return 0;
         }
 
@@ -699,6 +696,5 @@ ldp_pdu_print(netdissect_options *ndo,
     }
     return pdu_len+4;
 trunc:
-    nd_print_trunc(ndo);
-    return 0;
+    nd_trunc_longjmp(ndo);
 }