]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-sl.c
Add EXTRACT_ calls.
[tcpdump] / print-sl.c
index a0be325064f55ef19d9630476a056ef1d5c28f54..1805904133f7ad7acdc80ac25036f8d8af180efe 100644 (file)
@@ -59,9 +59,9 @@ u_int
 sl_if_print(netdissect_options *ndo,
             const struct pcap_pkthdr *h, const u_char *p)
 {
-       register u_int caplen = h->caplen;
-       register u_int length = h->len;
-       register const struct ip *ip;
+       u_int caplen = h->caplen;
+       u_int length = h->len;
+       const struct ip *ip;
 
        if (caplen < SLIP_HDRLEN || length < SLIP_HDRLEN) {
                ND_PRINT((ndo, "%s", tstr));
@@ -99,9 +99,9 @@ u_int
 sl_bsdos_if_print(netdissect_options *ndo,
                   const struct pcap_pkthdr *h, const u_char *p)
 {
-       register u_int caplen = h->caplen;
-       register u_int length = h->len;
-       register const struct ip *ip;
+       u_int caplen = h->caplen;
+       u_int length = h->len;
+       const struct ip *ip;
 
        if (caplen < SLIP_HDRLEN) {
                ND_PRINT((ndo, "%s", tstr));
@@ -124,13 +124,13 @@ sl_bsdos_if_print(netdissect_options *ndo,
 
 static void
 sliplink_print(netdissect_options *ndo,
-               register const u_char *p, register const struct ip *ip,
-               register u_int length)
+               const u_char *p, const struct ip *ip,
+               u_int length)
 {
        int dir;
        u_int hlen;
 
-       dir = p[SLX_DIR];
+       dir = EXTRACT_U_1(p + SLX_DIR);
        switch (dir) {
 
        case SLIPDIR_IN:
@@ -148,7 +148,7 @@ sliplink_print(netdissect_options *ndo,
        }
        if (ndo->ndo_nflag) {
                /* XXX just dump the header */
-               register int i;
+               int i;
 
                for (i = SLX_CHDR; i < SLX_CHDR + CHDR_LEN - 1; ++i)
                        ND_PRINT((ndo, "%02x.", EXTRACT_U_1(p + i)));
@@ -167,7 +167,7 @@ sliplink_print(netdissect_options *ndo,
                 * Get it from the link layer since sl_uncompress_tcp()
                 * has restored the IP header copy to IPPROTO_TCP.
                 */
-               lastconn = ((const struct ip *)&p[SLX_CHDR])->ip_p;
+               lastconn = EXTRACT_U_1(((const struct ip *)(p + SLX_CHDR))->ip_p);
                ND_PRINT((ndo, "utcp %d: ", lastconn));
                if (dir == -1) {
                        /* Direction is bogus, don't use it */
@@ -183,7 +183,7 @@ sliplink_print(netdissect_options *ndo,
                        /* Direction is bogus, don't use it */
                        return;
                }
-               if (p[SLX_CHDR] & TYPE_COMPRESSED_TCP) {
+               if (EXTRACT_U_1(p + SLX_CHDR) & TYPE_COMPRESSED_TCP) {
                        compressed_sl_print(ndo, p + SLX_CHDR, ip,
                                            length, dir);
                        ND_PRINT((ndo, ": "));
@@ -194,11 +194,12 @@ sliplink_print(netdissect_options *ndo,
 
 static const u_char *
 print_sl_change(netdissect_options *ndo,
-                const char *str, register const u_char *cp)
+                const char *str, const u_char *cp)
 {
-       register u_int i;
+       u_int i;
 
-       if ((i = *cp++) == 0) {
+       if ((i = EXTRACT_U_1(cp)) == 0) {
+               cp++;
                i = EXTRACT_BE_U_2(cp);
                cp += 2;
        }
@@ -208,11 +209,12 @@ print_sl_change(netdissect_options *ndo,
 
 static const u_char *
 print_sl_winchange(netdissect_options *ndo,
-                   register const u_char *cp)
+                   const u_char *cp)
 {
-       register short i;
+       short i;
 
-       if ((i = *cp++) == 0) {
+       if ((i = EXTRACT_U_1(cp)) == 0) {
+               cp++;
                i = EXTRACT_BE_U_2(cp);
                cp += 2;
        }
@@ -228,8 +230,8 @@ compressed_sl_print(netdissect_options *ndo,
                     const u_char *chdr, const struct ip *ip,
                     u_int length, int dir)
 {
-       register const u_char *cp = chdr;
-       register u_int flags, hlen;
+       const u_char *cp = chdr;
+       u_int flags, hlen;
 
        flags = EXTRACT_U_1(cp);
        cp++;