X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/ba8936b39b0ce2ff02f3aeb307df4c27657652d8..a8abce5c5e2dce2ba6dbccd5d3829da104b80f9c:/print-isoclns.c diff --git a/print-isoclns.c b/print-isoclns.c index 38f40d19..b9935ebd 100644 --- a/print-isoclns.c +++ b/print-isoclns.c @@ -29,7 +29,7 @@ /* * specification: * - * CLNP: ISO 8473 + * CLNP: ISO 8473 (respective ITU version is at http://www.itu.int/rec/T-REC-X.233/en/) * ES-IS: ISO 9542 * IS-IS: ISO 10589 */ @@ -679,10 +679,7 @@ void isoclns_print(netdissect_options *ndo, const u_char *p, u_int length) { ndo->ndo_protocol = "isoclns"; - if (!ND_TTEST_1(p)) { /* enough bytes on the wire ? */ - ND_PRINT("|OSI"); - return; - } + ND_TCHECK_1(p); /* enough bytes on the wire ? */ if (ndo->ndo_eflag) ND_PRINT("OSI NLPID %s (0x%02x): ", tok2str(nlpid_values, "Unknown", EXTRACT_U_1(p)), EXTRACT_U_1(p)); @@ -731,6 +728,9 @@ isoclns_print(netdissect_options *ndo, const u_char *p, u_int length) print_unknown_data(ndo, p, "\n\t", length); break; } + return; +trunc: + nd_print_trunc(ndo); } #define CLNP_PDU_ER 1 @@ -903,7 +903,7 @@ clnp_print(netdissect_options *ndo, } /* now walk the options */ - while (li_remaining >= 2) { + while (li_remaining != 0) { u_int op, opli; const uint8_t *tptr; @@ -1058,6 +1058,18 @@ clnp_print(netdissect_options *ndo, break; } + /* The cases above break from the switch block if they see and print + * a CLNP header in the Data part. For an Error Report PDU this is + * described in Section 7.9.6 of ITU X.233 (1997 E), also known as + * ISO/IEC 8473-1:1998(E). It is not clear why in this code the same + * applies to an Echo Response PDU, as the standard does not specify + * the contents -- could be a proprietary extension or a bug. In either + * case, if the Data part does not contain a CLNP header, its structure + * is considered unknown and the decoding falls through to print the + * contents as-is. + */ + ND_FALL_THROUGH; + case CLNP_PDU_DT: case CLNP_PDU_MD: case CLNP_PDU_ERQ: @@ -1386,6 +1398,8 @@ esis_print(netdissect_options *ndo, print_unknown_data(ndo, pptr, "\n\t ", opli); pptr += opli; } + return; + trunc: nd_print_trunc(ndo); } @@ -1408,6 +1422,7 @@ isis_print_mcid(netdissect_options *ndo, for(i=0;i<16;i++) ND_PRINT("%.2x ", mcid->digest[i]); + return; trunc: nd_print_trunc(ndo);