X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/1a90fd99d279d63242419a30ba3e0720872bff75..9f957a5883cb4c5c99cefa71b42fc9d2d27d73e1:/print-sl.c diff --git a/print-sl.c b/print-sl.c index 419864ef..18059041 100644 --- a/print-sl.c +++ b/print-sl.c @@ -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,14 +148,14 @@ 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))); ND_PRINT((ndo, "%02x: ", EXTRACT_U_1(p + SLX_CHDR + CHDR_LEN - 1))); return; } - switch (p[SLX_CHDR] & 0xf0) { + switch (EXTRACT_U_1(p + SLX_CHDR) & 0xf0) { case TYPE_IP: ND_PRINT((ndo, "ip %d: ", length + SLIP_HDRLEN)); @@ -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,9 +183,9 @@ sliplink_print(netdissect_options *ndo, /* Direction is bogus, don't use it */ return; } - if (p[SLX_CHDR] & TYPE_COMPRESSED_TCP) { - compressed_sl_print(ndo, &p[SLX_CHDR], ip, - length, dir); + if (EXTRACT_U_1(p + SLX_CHDR) & TYPE_COMPRESSED_TCP) { + compressed_sl_print(ndo, p + SLX_CHDR, ip, + length, dir); ND_PRINT((ndo, ": ")); } else ND_PRINT((ndo, "slip-%d!: ", EXTRACT_U_1(p + SLX_CHDR))); @@ -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++;