X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/fb2479d733dbe8a991d11909b319341f7db62ab1..72b94e239a5cbebf59d8640f574d8fd5d1763398:/print-ldp.c?ds=inline diff --git a/print-ldp.c b/print-ldp.c index ce0489b0..351c1f81 100644 --- a/print-ldp.c +++ b/print-ldp.c @@ -29,6 +29,7 @@ #include "l2vpn.h" #include "af.h" + /* * ldp common header * @@ -303,19 +304,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: @@ -441,7 +442,7 @@ ldp_tlv_print(netdissect_options *ndo, case LDP_FEC_MARTINI_IFPARM_DESC: ND_PRINT(": "); for (idx = 2; idx < vc_info_tlv_len; idx++) - safeputchar(ndo, EXTRACT_U_1(tptr + idx)); + fn_print_char(ndo, EXTRACT_U_1(tptr + idx)); break; case LDP_FEC_MARTINI_IFPARM_VCCV: @@ -534,7 +535,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_trunc(ndo); return 0; badtlv: @@ -547,6 +548,8 @@ ldp_print(netdissect_options *ndo, const u_char *pptr, u_int len) { int processed; + + ndo->ndo_protocol = "ldp"; while (len > (sizeof(struct ldp_common_header) + sizeof(struct ldp_msg_header))) { processed = ldp_pdu_print(ndo, pptr); if (processed == 0) @@ -593,7 +596,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,13 +689,6 @@ ldp_pdu_print(netdissect_options *ndo, } return pdu_len+4; trunc: - ND_PRINT("\n\t\t packet exceeded snapshot"); + nd_print_trunc(ndo); return 0; } - -/* - * Local Variables: - * c-style: whitesmith - * c-basic-offset: 8 - * End: - */