]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ldp.c
Add and use tstr[]
[tcpdump] / print-ldp.c
index ce0489b0e2bd89743c829b302d52bffc4f3b3b4c..1e1f1b679e073ff17011aed3bf7d077f1a4e7225 100644 (file)
@@ -29,6 +29,8 @@
 #include "l2vpn.h"
 #include "af.h"
 
+static const char tstr[] = " [|ldp]";
+
 /*
  * ldp common header
  *
@@ -303,19 +305,19 @@ ldp_tlv_print(netdissect_options *ndo,
                tok2str(af_values, "Unknown (%u)", af));
         switch (af) {
         case AFNUM_INET:
-           while(tlv_tlen >= sizeof(struct in_addr)) {
-               ND_TCHECK_LEN(tptr, sizeof(struct in_addr));
+           while(tlv_tlen >= sizeof(nd_ipv4)) {
+               ND_TCHECK_LEN(tptr, sizeof(nd_ipv4));
                ND_PRINT(" %s", ipaddr_string(ndo, tptr));
-               tlv_tlen-=sizeof(struct in_addr);
-               tptr+=sizeof(struct in_addr);
+               tlv_tlen-=sizeof(nd_ipv4);
+               tptr+=sizeof(nd_ipv4);
            }
             break;
         case AFNUM_INET6:
-           while(tlv_tlen >= sizeof(struct in6_addr)) {
-               ND_TCHECK_LEN(tptr, sizeof(struct in6_addr));
+           while(tlv_tlen >= sizeof(nd_ipv6)) {
+               ND_TCHECK_LEN(tptr, sizeof(nd_ipv6));
                ND_PRINT(" %s", ip6addr_string(ndo, tptr));
-               tlv_tlen-=sizeof(struct in6_addr);
-               tptr+=sizeof(struct in6_addr);
+               tlv_tlen-=sizeof(nd_ipv6);
+               tptr+=sizeof(nd_ipv6);
            }
             break;
         default:
@@ -534,7 +536,7 @@ ldp_tlv_print(netdissect_options *ndo,
     return(tlv_len+4); /* Type & Length fields not included */
 
 trunc:
-    ND_PRINT("\n\t\t packet exceeded snapshot");
+    ND_PRINT("%s", tstr);
     return 0;
 
 badtlv:
@@ -593,7 +595,7 @@ ldp_pdu_print(netdissect_options *ndo,
     /* 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),
+           ipaddr_string(ndo, ldp_com_header->lsr_id),
            EXTRACT_BE_U_2(ldp_com_header->label_space),
            pdu_len);
 
@@ -686,7 +688,7 @@ ldp_pdu_print(netdissect_options *ndo,
     }
     return pdu_len+4;
 trunc:
-    ND_PRINT("\n\t\t packet exceeded snapshot");
+    ND_PRINT("%s", tstr);
     return 0;
 }