]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-rt6.c
Use more the ND_TTEST_1() macro
[tcpdump] / print-rt6.c
index 31da35ea972033c097050b05b22ab4987f8b9b06..269496aaecfc98ccfd107b626e4cf83be2a03a95 100644 (file)
 #include "ip6.h"
 
 int
-rt6_print(netdissect_options *ndo, register const u_char *bp, const u_char *bp2 _U_)
+rt6_print(netdissect_options *ndo, const u_char *bp, const u_char *bp2 _U_)
 {
-       register const struct ip6_rthdr *dp;
-       register const struct ip6_rthdr0 *dp0;
-       register const u_char *ep;
-       int i, len;
-       register const struct in6_addr *addr;
+       const struct ip6_rthdr *dp;
+       const struct ip6_rthdr0 *dp0;
+       const u_char *ep;
+       u_int i, len, type;
+       const struct in6_addr *addr;
 
        dp = (const struct ip6_rthdr *)bp;
 
@@ -51,12 +51,13 @@ rt6_print(netdissect_options *ndo, register const u_char *bp, const u_char *bp2
 
        ND_TCHECK(dp->ip6r_segleft);
 
-       len = dp->ip6r_len;
-       ND_PRINT((ndo, "srcrt (len=%d", dp->ip6r_len)); /*)*/
-       ND_PRINT((ndo, ", type=%d", dp->ip6r_type));
-       ND_PRINT((ndo, ", segleft=%d", dp->ip6r_segleft));
+       len = EXTRACT_U_1(dp->ip6r_len);
+       ND_PRINT((ndo, "srcrt (len=%u", len));  /*)*/
+       type = EXTRACT_U_1(dp->ip6r_type);
+       ND_PRINT((ndo, ", type=%u", type));
+       ND_PRINT((ndo, ", segleft=%u", EXTRACT_U_1(dp->ip6r_segleft)));
 
-       switch (dp->ip6r_type) {
+       switch (type) {
        case IPV6_RTHDR_TYPE_0:
        case IPV6_RTHDR_TYPE_2:                 /* Mobile IPv6 ID-20 */
                dp0 = (const struct ip6_rthdr0 *)dp;