X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/11d3a01319e295dcabfb2647302d278938449226..195a4cfd9de46b47ac6794930e19e38ed263b05f:/print-decnet.c diff --git a/print-decnet.c b/print-decnet.c index 864c4a37..b86bd889 100644 --- a/print-decnet.c +++ b/print-decnet.c @@ -326,7 +326,6 @@ union controlmsg #define COS_NONE 0 /* no flow control */ #define COS_SEGMENT 04 /* segment flow control */ #define COS_MESSAGE 010 /* message flow control */ -#define COS_CRYPTSER 020 /* cryptographic services requested */ #define COS_DEFAULT 1 /* default value for field */ #define COI_MASK 3 /* mask for version field */ @@ -492,9 +491,6 @@ static void print_i_info(netdissect_options *, int); static int print_elist(const char *, u_int); static int print_nsp(netdissect_options *, const u_char *, u_int); static void print_reason(netdissect_options *, int); -#ifdef PRINT_NSPDATA -static void pdata(netdissect_options *, u_char *, u_int); -#endif #ifndef HAVE_NETDNET_DNETDB_H_DNET_HTOA extern char *dnet_htoa(struct dn_naddr *); @@ -502,11 +498,11 @@ extern char *dnet_htoa(struct dn_naddr *); void decnet_print(netdissect_options *ndo, - register const u_char *ap, register u_int length, - register u_int caplen) + const u_char *ap, u_int length, + u_int caplen) { - register const union routehdr *rhp; - register int mflags; + const union routehdr *rhp; + int mflags; int dst, src, hops; u_int nsplen, pktlen; const u_char *nspp; @@ -516,8 +512,8 @@ decnet_print(netdissect_options *ndo, return; } - ND_TCHECK2(*ap, sizeof(short)); - pktlen = EXTRACT_LE_16BITS(ap); + ND_TCHECK_LEN(ap, sizeof(short)); + pktlen = EXTRACT_LE_U_2(ap); if (pktlen < sizeof(struct shorthdr)) { ND_PRINT((ndo, "%s", tstr)); return; @@ -528,9 +524,9 @@ decnet_print(netdissect_options *ndo, } length = pktlen; - rhp = (const union routehdr *)&(ap[sizeof(short)]); + rhp = (const union routehdr *)(ap + sizeof(short)); ND_TCHECK(rhp->rh_short.sh_flags); - mflags = EXTRACT_LE_8BITS(rhp->rh_short.sh_flags); + mflags = EXTRACT_U_1(rhp->rh_short.sh_flags); if (mflags & RMF_PAD) { /* pad bytes of some sort in front of message */ @@ -541,12 +537,13 @@ decnet_print(netdissect_options *ndo, ND_PRINT((ndo, "%s", tstr)); return; } - ND_TCHECK2(ap[sizeof(short)], padlen); + ND_TCHECK_LEN(ap + sizeof(short), padlen); ap += padlen; length -= padlen; caplen -= padlen; - rhp = (const union routehdr *)&(ap[sizeof(short)]); - mflags = EXTRACT_LE_8BITS(rhp->rh_short.sh_flags); + rhp = (const union routehdr *)(ap + sizeof(short)); + ND_TCHECK(rhp->rh_short.sh_flags); + mflags = EXTRACT_U_1(rhp->rh_short.sh_flags); } if (mflags & RMF_FVER) { @@ -570,19 +567,19 @@ decnet_print(netdissect_options *ndo, } ND_TCHECK(rhp->rh_long); dst = - EXTRACT_LE_16BITS(rhp->rh_long.lg_dst.dne_remote.dne_nodeaddr); + EXTRACT_LE_U_2(rhp->rh_long.lg_dst.dne_remote.dne_nodeaddr); src = - EXTRACT_LE_16BITS(rhp->rh_long.lg_src.dne_remote.dne_nodeaddr); - hops = EXTRACT_LE_8BITS(rhp->rh_long.lg_visits); - nspp = &(ap[sizeof(short) + sizeof(struct longhdr)]); + EXTRACT_LE_U_2(rhp->rh_long.lg_src.dne_remote.dne_nodeaddr); + hops = EXTRACT_U_1(rhp->rh_long.lg_visits); + nspp = ap + sizeof(short) + sizeof(struct longhdr); nsplen = length - sizeof(struct longhdr); break; case RMF_SHORT: ND_TCHECK(rhp->rh_short); - dst = EXTRACT_LE_16BITS(rhp->rh_short.sh_dst); - src = EXTRACT_LE_16BITS(rhp->rh_short.sh_src); - hops = (EXTRACT_LE_8BITS(rhp->rh_short.sh_visits) & VIS_MASK)+1; - nspp = &(ap[sizeof(short) + sizeof(struct shorthdr)]); + dst = EXTRACT_LE_U_2(rhp->rh_short.sh_dst); + src = EXTRACT_LE_U_2(rhp->rh_short.sh_src); + hops = (EXTRACT_U_1(rhp->rh_short.sh_visits) & VIS_MASK)+1; + nspp = ap + sizeof(short) + sizeof(struct shorthdr); nsplen = length - sizeof(struct shorthdr); break; default: @@ -614,11 +611,12 @@ trunc: static int print_decnet_ctlmsg(netdissect_options *ndo, - register const union routehdr *rhp, u_int length, + const union routehdr *rhp, u_int length, u_int caplen) { - int mflags = EXTRACT_LE_8BITS(rhp->rh_short.sh_flags); - register const union controlmsg *cmp = (const union controlmsg *)rhp; + /* Our caller has already checked for mflags */ + int mflags = EXTRACT_U_1(rhp->rh_short.sh_flags); + const union controlmsg *cmp = (const union controlmsg *)rhp; int src, dst, info, blksize, eco, ueco, hello, other, vers; etheraddr srcea, rtea; int priority; @@ -631,13 +629,13 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct initmsg)) goto trunc; ND_TCHECK(cmp->cm_init); - src = EXTRACT_LE_16BITS(cmp->cm_init.in_src); - info = EXTRACT_LE_8BITS(cmp->cm_init.in_info); - blksize = EXTRACT_LE_16BITS(cmp->cm_init.in_blksize); - vers = EXTRACT_LE_8BITS(cmp->cm_init.in_vers); - eco = EXTRACT_LE_8BITS(cmp->cm_init.in_eco); - ueco = EXTRACT_LE_8BITS(cmp->cm_init.in_ueco); - hello = EXTRACT_LE_16BITS(cmp->cm_init.in_hello); + src = EXTRACT_LE_U_2(cmp->cm_init.in_src); + info = EXTRACT_U_1(cmp->cm_init.in_info); + blksize = EXTRACT_LE_U_2(cmp->cm_init.in_blksize); + vers = EXTRACT_U_1(cmp->cm_init.in_vers); + eco = EXTRACT_U_1(cmp->cm_init.in_eco); + ueco = EXTRACT_U_1(cmp->cm_init.in_ueco); + hello = EXTRACT_LE_U_2(cmp->cm_init.in_hello); print_t_info(ndo, info); ND_PRINT((ndo, "src %sblksize %d vers %d eco %d ueco %d hello %d", @@ -650,8 +648,8 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct verifmsg)) goto trunc; ND_TCHECK(cmp->cm_ver); - src = EXTRACT_LE_16BITS(cmp->cm_ver.ve_src); - other = EXTRACT_LE_8BITS(cmp->cm_ver.ve_fcnval); + src = EXTRACT_LE_U_2(cmp->cm_ver.ve_src); + other = EXTRACT_U_1(cmp->cm_ver.ve_fcnval); ND_PRINT((ndo, "src %s fcnval %o", dnaddr_string(ndo, src), other)); ret = 1; break; @@ -660,8 +658,8 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct testmsg)) goto trunc; ND_TCHECK(cmp->cm_test); - src = EXTRACT_LE_16BITS(cmp->cm_test.te_src); - other = EXTRACT_LE_8BITS(cmp->cm_test.te_data); + src = EXTRACT_LE_U_2(cmp->cm_test.te_src); + other = EXTRACT_U_1(cmp->cm_test.te_data); ND_PRINT((ndo, "src %s data %o", dnaddr_string(ndo, src), other)); ret = 1; break; @@ -670,7 +668,7 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct l1rout)) goto trunc; ND_TCHECK(cmp->cm_l1rou); - src = EXTRACT_LE_16BITS(cmp->cm_l1rou.r1_src); + src = EXTRACT_LE_U_2(cmp->cm_l1rou.r1_src); ND_PRINT((ndo, "src %s ", dnaddr_string(ndo, src))); ret = print_l1_routes(ndo, &(rhpx[sizeof(struct l1rout)]), length - sizeof(struct l1rout)); @@ -680,7 +678,7 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct l2rout)) goto trunc; ND_TCHECK(cmp->cm_l2rout); - src = EXTRACT_LE_16BITS(cmp->cm_l2rout.r2_src); + src = EXTRACT_LE_U_2(cmp->cm_l2rout.r2_src); ND_PRINT((ndo, "src %s ", dnaddr_string(ndo, src))); ret = print_l2_routes(ndo, &(rhpx[sizeof(struct l2rout)]), length - sizeof(struct l2rout)); @@ -690,16 +688,16 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct rhellomsg)) goto trunc; ND_TCHECK(cmp->cm_rhello); - vers = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_vers); - eco = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_eco); - ueco = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_ueco); + vers = EXTRACT_U_1(cmp->cm_rhello.rh_vers); + eco = EXTRACT_U_1(cmp->cm_rhello.rh_eco); + ueco = EXTRACT_U_1(cmp->cm_rhello.rh_ueco); memcpy((char *)&srcea, (const char *)&(cmp->cm_rhello.rh_src), sizeof(srcea)); - src = EXTRACT_LE_16BITS(srcea.dne_remote.dne_nodeaddr); - info = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_info); - blksize = EXTRACT_LE_16BITS(cmp->cm_rhello.rh_blksize); - priority = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_priority); - hello = EXTRACT_LE_16BITS(cmp->cm_rhello.rh_hello); + src = EXTRACT_LE_U_2(srcea.dne_remote.dne_nodeaddr); + info = EXTRACT_U_1(cmp->cm_rhello.rh_info); + blksize = EXTRACT_LE_U_2(cmp->cm_rhello.rh_blksize); + priority = EXTRACT_U_1(cmp->cm_rhello.rh_priority); + hello = EXTRACT_LE_U_2(cmp->cm_rhello.rh_hello); print_i_info(ndo, info); ND_PRINT((ndo, "vers %d eco %d ueco %d src %s blksize %d pri %d hello %d", @@ -713,20 +711,20 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct ehellomsg)) goto trunc; ND_TCHECK(cmp->cm_ehello); - vers = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_vers); - eco = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_eco); - ueco = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_ueco); + vers = EXTRACT_U_1(cmp->cm_ehello.eh_vers); + eco = EXTRACT_U_1(cmp->cm_ehello.eh_eco); + ueco = EXTRACT_U_1(cmp->cm_ehello.eh_ueco); memcpy((char *)&srcea, (const char *)&(cmp->cm_ehello.eh_src), sizeof(srcea)); - src = EXTRACT_LE_16BITS(srcea.dne_remote.dne_nodeaddr); - info = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_info); - blksize = EXTRACT_LE_16BITS(cmp->cm_ehello.eh_blksize); + src = EXTRACT_LE_U_2(srcea.dne_remote.dne_nodeaddr); + info = EXTRACT_U_1(cmp->cm_ehello.eh_info); + blksize = EXTRACT_LE_U_2(cmp->cm_ehello.eh_blksize); /*seed*/ memcpy((char *)&rtea, (const char *)&(cmp->cm_ehello.eh_router), sizeof(rtea)); - dst = EXTRACT_LE_16BITS(rtea.dne_remote.dne_nodeaddr); - hello = EXTRACT_LE_16BITS(cmp->cm_ehello.eh_hello); - other = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_data); + dst = EXTRACT_LE_U_2(rtea.dne_remote.dne_nodeaddr); + hello = EXTRACT_LE_U_2(cmp->cm_ehello.eh_hello); + other = EXTRACT_U_1(cmp->cm_ehello.eh_data); print_i_info(ndo, info); ND_PRINT((ndo, "vers %d eco %d ueco %d src %s blksize %d rtr %s hello %d data %o", @@ -774,16 +772,16 @@ print_l1_routes(netdissect_options *ndo, /* The last short is a checksum */ while (len > (3 * sizeof(short))) { - ND_TCHECK2(*rp, 3 * sizeof(short)); - count = EXTRACT_LE_16BITS(rp); + ND_TCHECK_LEN(rp, 3 * sizeof(short)); + count = EXTRACT_LE_U_2(rp); if (count > 1024) return (1); /* seems to be bogus from here on */ rp += sizeof(short); len -= sizeof(short); - id = EXTRACT_LE_16BITS(rp); + id = EXTRACT_LE_U_2(rp); rp += sizeof(short); len -= sizeof(short); - info = EXTRACT_LE_16BITS(rp); + info = EXTRACT_LE_U_2(rp); rp += sizeof(short); len -= sizeof(short); ND_PRINT((ndo, "{ids %d-%d cost %d hops %d} ", id, id + count, @@ -805,16 +803,16 @@ print_l2_routes(netdissect_options *ndo, /* The last short is a checksum */ while (len > (3 * sizeof(short))) { - ND_TCHECK2(*rp, 3 * sizeof(short)); - count = EXTRACT_LE_16BITS(rp); + ND_TCHECK_LEN(rp, 3 * sizeof(short)); + count = EXTRACT_LE_U_2(rp); if (count > 1024) return (1); /* seems to be bogus from here on */ rp += sizeof(short); len -= sizeof(short); - area = EXTRACT_LE_16BITS(rp); + area = EXTRACT_LE_U_2(rp); rp += sizeof(short); len -= sizeof(short); - info = EXTRACT_LE_16BITS(rp); + info = EXTRACT_LE_U_2(rp); rp += sizeof(short); len -= sizeof(short); ND_PRINT((ndo, "{areas %d-%d cost %d hops %d} ", area, area + count, @@ -862,9 +860,9 @@ print_nsp(netdissect_options *ndo, if (nsplen < sizeof(struct nsphdr)) goto trunc; ND_TCHECK(*nsphp); - flags = EXTRACT_LE_8BITS(nsphp->nh_flags); - dst = EXTRACT_LE_16BITS(nsphp->nh_dst); - src = EXTRACT_LE_16BITS(nsphp->nh_src); + flags = EXTRACT_U_1(nsphp->nh_flags); + dst = EXTRACT_LE_U_2(nsphp->nh_dst); + src = EXTRACT_LE_U_2(nsphp->nh_src); switch (flags & NSP_TYPEMASK) { case MFT_DATA: @@ -877,15 +875,12 @@ print_nsp(netdissect_options *ndo, { const struct seghdr *shp = (const struct seghdr *)nspp; int ack; -#ifdef PRINT_NSPDATA - const u_char *dp; -#endif u_int data_off = sizeof(struct minseghdr); if (nsplen < data_off) goto trunc; ND_TCHECK(shp->sh_seq[0]); - ack = EXTRACT_LE_16BITS(shp->sh_seq[0]); + ack = EXTRACT_LE_U_2(shp->sh_seq[0]); if (ack & SGQ_ACK) { /* acknum field */ if ((ack & SGQ_NAK) == SGQ_NAK) ND_PRINT((ndo, "nak %d ", ack & SGQ_MASK)); @@ -895,7 +890,7 @@ print_nsp(netdissect_options *ndo, if (nsplen < data_off) goto trunc; ND_TCHECK(shp->sh_seq[1]); - ack = EXTRACT_LE_16BITS(shp->sh_seq[1]); + ack = EXTRACT_LE_U_2(shp->sh_seq[1]); if (ack & SGQ_OACK) { /* ackoth field */ if ((ack & SGQ_ONAK) == SGQ_ONAK) ND_PRINT((ndo, "onak %d ", ack & SGQ_MASK)); @@ -905,17 +900,10 @@ print_nsp(netdissect_options *ndo, if (nsplen < data_off) goto trunc; ND_TCHECK(shp->sh_seq[2]); - ack = EXTRACT_LE_16BITS(shp->sh_seq[2]); + ack = EXTRACT_LE_U_2(shp->sh_seq[2]); } } ND_PRINT((ndo, "seg %d ", ack & SGQ_MASK)); -#ifdef PRINT_NSPDATA - if (nsplen > data_off) { - dp = &(nspp[data_off]); - ND_TCHECK2(*dp, nsplen - data_off); - pdata(ndo, dp, nsplen - data_off); - } -#endif } break; case MFS_ILS+MFS_INT: @@ -923,15 +911,12 @@ print_nsp(netdissect_options *ndo, { const struct seghdr *shp = (const struct seghdr *)nspp; int ack; -#ifdef PRINT_NSPDATA - const u_char *dp; -#endif u_int data_off = sizeof(struct minseghdr); if (nsplen < data_off) goto trunc; ND_TCHECK(shp->sh_seq[0]); - ack = EXTRACT_LE_16BITS(shp->sh_seq[0]); + ack = EXTRACT_LE_U_2(shp->sh_seq[0]); if (ack & SGQ_ACK) { /* acknum field */ if ((ack & SGQ_NAK) == SGQ_NAK) ND_PRINT((ndo, "nak %d ", ack & SGQ_MASK)); @@ -941,7 +926,7 @@ print_nsp(netdissect_options *ndo, if (nsplen < data_off) goto trunc; ND_TCHECK(shp->sh_seq[1]); - ack = EXTRACT_LE_16BITS(shp->sh_seq[1]); + ack = EXTRACT_LE_U_2(shp->sh_seq[1]); if (ack & SGQ_OACK) { /* ackdat field */ if ((ack & SGQ_ONAK) == SGQ_ONAK) ND_PRINT((ndo, "nakdat %d ", ack & SGQ_MASK)); @@ -951,17 +936,10 @@ print_nsp(netdissect_options *ndo, if (nsplen < data_off) goto trunc; ND_TCHECK(shp->sh_seq[2]); - ack = EXTRACT_LE_16BITS(shp->sh_seq[2]); + ack = EXTRACT_LE_U_2(shp->sh_seq[2]); } } ND_PRINT((ndo, "seg %d ", ack & SGQ_MASK)); -#ifdef PRINT_NSPDATA - if (nsplen > data_off) { - dp = &(nspp[data_off]); - ND_TCHECK2(*dp, nsplen - data_off); - pdata(ndo, dp, nsplen - data_off); - } -#endif } break; case MFS_ILS: @@ -969,34 +947,34 @@ print_nsp(netdissect_options *ndo, { const struct seghdr *shp = (const struct seghdr *)nspp; const struct lsmsg *lsmp = - (const struct lsmsg *)&(nspp[sizeof(struct seghdr)]); + (const struct lsmsg *)(nspp + sizeof(struct seghdr)); int ack; int lsflags, fcval; if (nsplen < sizeof(struct seghdr) + sizeof(struct lsmsg)) goto trunc; ND_TCHECK(shp->sh_seq[0]); - ack = EXTRACT_LE_16BITS(shp->sh_seq[0]); + ack = EXTRACT_LE_U_2(shp->sh_seq[0]); if (ack & SGQ_ACK) { /* acknum field */ if ((ack & SGQ_NAK) == SGQ_NAK) ND_PRINT((ndo, "nak %d ", ack & SGQ_MASK)); else ND_PRINT((ndo, "ack %d ", ack & SGQ_MASK)); ND_TCHECK(shp->sh_seq[1]); - ack = EXTRACT_LE_16BITS(shp->sh_seq[1]); + ack = EXTRACT_LE_U_2(shp->sh_seq[1]); if (ack & SGQ_OACK) { /* ackdat field */ if ((ack & SGQ_ONAK) == SGQ_ONAK) ND_PRINT((ndo, "nakdat %d ", ack & SGQ_MASK)); else ND_PRINT((ndo, "ackdat %d ", ack & SGQ_MASK)); ND_TCHECK(shp->sh_seq[2]); - ack = EXTRACT_LE_16BITS(shp->sh_seq[2]); + ack = EXTRACT_LE_U_2(shp->sh_seq[2]); } } ND_PRINT((ndo, "seg %d ", ack & SGQ_MASK)); ND_TCHECK(*lsmp); - lsflags = EXTRACT_LE_8BITS(lsmp->ls_lsflags); - fcval = EXTRACT_LE_8BITS(lsmp->ls_fcval); + lsflags = EXTRACT_U_1(lsmp->ls_lsflags); + fcval = EXTRACT_U_1(lsmp->ls_fcval); switch (lsflags & LSI_MASK) { case LSI_DATA: ND_PRINT((ndo, "dat seg count %d ", fcval)); @@ -1039,13 +1017,13 @@ print_nsp(netdissect_options *ndo, if (nsplen < sizeof(struct ackmsg)) goto trunc; ND_TCHECK(*amp); - ack = EXTRACT_LE_16BITS(amp->ak_acknum[0]); + ack = EXTRACT_LE_U_2(amp->ak_acknum[0]); if (ack & SGQ_ACK) { /* acknum field */ if ((ack & SGQ_NAK) == SGQ_NAK) ND_PRINT((ndo, "nak %d ", ack & SGQ_MASK)); else ND_PRINT((ndo, "ack %d ", ack & SGQ_MASK)); - ack = EXTRACT_LE_16BITS(amp->ak_acknum[1]); + ack = EXTRACT_LE_U_2(amp->ak_acknum[1]); if (ack & SGQ_OACK) { /* ackoth field */ if ((ack & SGQ_ONAK) == SGQ_ONAK) ND_PRINT((ndo, "onak %d ", ack & SGQ_MASK)); @@ -1064,14 +1042,14 @@ print_nsp(netdissect_options *ndo, if (nsplen < sizeof(struct ackmsg)) goto trunc; ND_TCHECK(*amp); - ack = EXTRACT_LE_16BITS(amp->ak_acknum[0]); + ack = EXTRACT_LE_U_2(amp->ak_acknum[0]); if (ack & SGQ_ACK) { /* acknum field */ if ((ack & SGQ_NAK) == SGQ_NAK) ND_PRINT((ndo, "nak %d ", ack & SGQ_MASK)); else ND_PRINT((ndo, "ack %d ", ack & SGQ_MASK)); ND_TCHECK(amp->ak_acknum[1]); - ack = EXTRACT_LE_16BITS(amp->ak_acknum[1]); + ack = EXTRACT_LE_U_2(amp->ak_acknum[1]); if (ack & SGQ_OACK) { /* ackdat field */ if ((ack & SGQ_ONAK) == SGQ_ONAK) ND_PRINT((ndo, "nakdat %d ", ack & SGQ_MASK)); @@ -1101,16 +1079,13 @@ print_nsp(netdissect_options *ndo, { const struct cimsg *cimp = (const struct cimsg *)nspp; int services, info, segsize; -#ifdef PRINT_NSPDATA - const u_char *dp; -#endif if (nsplen < sizeof(struct cimsg)) goto trunc; ND_TCHECK(*cimp); - services = EXTRACT_LE_8BITS(cimp->ci_services); - info = EXTRACT_LE_8BITS(cimp->ci_info); - segsize = EXTRACT_LE_16BITS(cimp->ci_segsize); + services = EXTRACT_U_1(cimp->ci_services); + info = EXTRACT_U_1(cimp->ci_info); + segsize = EXTRACT_LE_U_2(cimp->ci_segsize); switch (services & COS_MASK) { case COS_NONE: @@ -1121,9 +1096,6 @@ print_nsp(netdissect_options *ndo, case COS_MESSAGE: ND_PRINT((ndo, "msg ")); break; - case COS_CRYPTSER: - ND_PRINT((ndo, "crypt ")); - break; } switch (info & COI_MASK) { case COI_32: @@ -1140,13 +1112,6 @@ print_nsp(netdissect_options *ndo, break; } ND_PRINT((ndo, "segsize %d ", segsize)); -#ifdef PRINT_NSPDATA - if (nsplen > sizeof(struct cimsg)) { - dp = &(nspp[sizeof(struct cimsg)]); - ND_TCHECK2(*dp, nsplen - sizeof(struct cimsg)); - pdata(ndo, dp, nsplen - sizeof(struct cimsg)); - } -#endif } break; case MFS_CC: @@ -1155,17 +1120,14 @@ print_nsp(netdissect_options *ndo, const struct ccmsg *ccmp = (const struct ccmsg *)nspp; int services, info; u_int segsize, optlen; -#ifdef PRINT_NSPDATA - const u_char *dp; -#endif if (nsplen < sizeof(struct ccmsg)) goto trunc; ND_TCHECK(*ccmp); - services = EXTRACT_LE_8BITS(ccmp->cc_services); - info = EXTRACT_LE_8BITS(ccmp->cc_info); - segsize = EXTRACT_LE_16BITS(ccmp->cc_segsize); - optlen = EXTRACT_LE_8BITS(ccmp->cc_optlen); + services = EXTRACT_U_1(ccmp->cc_services); + info = EXTRACT_U_1(ccmp->cc_info); + segsize = EXTRACT_LE_U_2(ccmp->cc_segsize); + optlen = EXTRACT_U_1(ccmp->cc_optlen); switch (services & COS_MASK) { case COS_NONE: @@ -1176,9 +1138,6 @@ print_nsp(netdissect_options *ndo, case COS_MESSAGE: ND_PRINT((ndo, "msg ")); break; - case COS_CRYPTSER: - ND_PRINT((ndo, "crypt ")); - break; } switch (info & COI_MASK) { case COI_32: @@ -1197,13 +1156,6 @@ print_nsp(netdissect_options *ndo, ND_PRINT((ndo, "segsize %d ", segsize)); if (optlen) { ND_PRINT((ndo, "optlen %d ", optlen)); -#ifdef PRINT_NSPDATA - if (optlen > nsplen - sizeof(struct ccmsg)) - goto trunc; - dp = &(nspp[sizeof(struct ccmsg)]); - ND_TCHECK2(*dp, optlen); - pdata(ndo, dp, optlen); -#endif } } break; @@ -1213,26 +1165,16 @@ print_nsp(netdissect_options *ndo, const struct dimsg *dimp = (const struct dimsg *)nspp; int reason; u_int optlen; -#ifdef PRINT_NSPDATA - const u_char *dp; -#endif if (nsplen < sizeof(struct dimsg)) goto trunc; ND_TCHECK(*dimp); - reason = EXTRACT_LE_16BITS(dimp->di_reason); - optlen = EXTRACT_LE_8BITS(dimp->di_optlen); + reason = EXTRACT_LE_U_2(dimp->di_reason); + optlen = EXTRACT_U_1(dimp->di_optlen); print_reason(ndo, reason); if (optlen) { ND_PRINT((ndo, "optlen %d ", optlen)); -#ifdef PRINT_NSPDATA - if (optlen > nsplen - sizeof(struct dimsg)) - goto trunc; - dp = &(nspp[sizeof(struct dimsg)]); - ND_TCHECK2(*dp, optlen); - pdata(ndo, dp, optlen); -#endif } } break; @@ -1243,7 +1185,7 @@ print_nsp(netdissect_options *ndo, int reason; ND_TCHECK(*dcmp); - reason = EXTRACT_LE_16BITS(dcmp->dc_reason); + reason = EXTRACT_LE_U_2(dcmp->dc_reason); print_reason(ndo, reason); } @@ -1291,7 +1233,7 @@ static const struct tok reason2str[] = { static void print_reason(netdissect_options *ndo, - register int reason) + int reason) { ND_PRINT((ndo, "%s ", tok2str(reason2str, "reason-%d", reason))); } @@ -1329,18 +1271,3 @@ dnname_string(netdissect_options *ndo, u_short dnaddr) return(dnnum_string(ndo, dnaddr)); /* punt */ #endif } - -#ifdef PRINT_NSPDATA -static void -pdata(netdissect_options *ndo, - u_char *dp, u_int maxlen) -{ - char c; - u_int x = maxlen; - - while (x-- > 0) { - c = *dp++; - safeputchar(ndo, c); - } -} -#endif