]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-decnet.c
Clean up ISAKMP dissection, use nd_ types and EXTRACT_ macros.
[tcpdump] / print-decnet.c
index 563b1eb4a842e56e0d65367fffa55e60303fd5ea..b86bd8896794442c1c42b708307019b7e5726462 100644 (file)
@@ -498,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;
@@ -512,7 +512,7 @@ decnet_print(netdissect_options *ndo,
                return;
        }
 
-       ND_TCHECK2(*ap, sizeof(short));
+       ND_TCHECK_LEN(ap, sizeof(short));
        pktlen = EXTRACT_LE_U_2(ap);
        if (pktlen < sizeof(struct shorthdr)) {
                ND_PRINT((ndo, "%s", tstr));
@@ -524,7 +524,7 @@ 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_U_1(rhp->rh_short.sh_flags);
 
@@ -537,11 +537,11 @@ 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)]);
+           rhp = (const union routehdr *)(ap + sizeof(short));
            ND_TCHECK(rhp->rh_short.sh_flags);
            mflags = EXTRACT_U_1(rhp->rh_short.sh_flags);
        }
@@ -571,7 +571,7 @@ decnet_print(netdissect_options *ndo,
            src =
                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)]);
+           nspp = ap + sizeof(short) + sizeof(struct longhdr);
            nsplen = length - sizeof(struct longhdr);
            break;
        case RMF_SHORT:
@@ -579,7 +579,7 @@ decnet_print(netdissect_options *ndo,
            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)]);
+           nspp = ap + sizeof(short) + sizeof(struct shorthdr);
            nsplen = length - sizeof(struct shorthdr);
            break;
        default:
@@ -611,12 +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)
 {
        /* Our caller has already checked for mflags */
        int mflags = EXTRACT_U_1(rhp->rh_short.sh_flags);
-       register const union controlmsg *cmp = (const union controlmsg *)rhp;
+       const union controlmsg *cmp = (const union controlmsg *)rhp;
        int src, dst, info, blksize, eco, ueco, hello, other, vers;
        etheraddr srcea, rtea;
        int priority;
@@ -772,7 +772,7 @@ print_l1_routes(netdissect_options *ndo,
 
        /* The last short is a checksum */
        while (len > (3 * sizeof(short))) {
-           ND_TCHECK2(*rp, 3 * sizeof(short));
+           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 */
@@ -803,7 +803,7 @@ print_l2_routes(netdissect_options *ndo,
 
        /* The last short is a checksum */
        while (len > (3 * sizeof(short))) {
-           ND_TCHECK2(*rp, 3 * sizeof(short));
+           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 */
@@ -947,7 +947,7 @@ 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;
 
@@ -1233,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)));
 }