X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/fb2479d733dbe8a991d11909b319341f7db62ab1..ad69daa2e4cf9ce6789295bd7f55a55ac4d9d0b2:/print-ldp.c?ds=sidebyside diff --git a/print-ldp.c b/print-ldp.c index ce0489b0..1e1f1b67 100644 --- a/print-ldp.c +++ b/print-ldp.c @@ -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; }