]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-lwres.c
Update .gitignore for other configurations
[tcpdump] / print-lwres.c
index 3712405251713fbb2263bcdfd84e32ec7437a913..320244296dd179433bdf5e1fa3507e8d4e7fa7e1 100644 (file)
@@ -204,8 +204,10 @@ lwres_printname(netdissect_options *ndo,
                goto trunc;
 
        ND_PRINT(" ");
-       for (i = 0; i < l; i++)
-               safeputchar(ndo, *p++);
+       for (i = 0; i < l; i++) {
+               fn_print_char(ndo, EXTRACT_U_1(p));
+               p++;
+       }
        p++;    /* skip terminating \0 */
 
        return p - p0;
@@ -248,8 +250,10 @@ lwres_printbinlen(netdissect_options *ndo,
        if (p + 2 + l > ndo->ndo_snapend)
                goto trunc;
        p += 2;
-       for (i = 0; i < l; i++)
-               ND_PRINT("%02x", *p++);
+       for (i = 0; i < l; i++) {
+               ND_PRINT("%02x", EXTRACT_U_1(p));
+               p++;
+       }
        return p - p0;
 
   trunc:
@@ -277,18 +281,20 @@ lwres_printaddr(netdissect_options *ndo,
                if (l < 4)
                        return -1;
                ND_PRINT(" %s", ipaddr_string(ndo, p));
-               p += sizeof(struct in_addr);
+               p += sizeof(nd_ipv4);
                break;
        case 2: /* IPv6 */
                if (l < 16)
                        return -1;
                ND_PRINT(" %s", ip6addr_string(ndo, p));
-               p += sizeof(struct in6_addr);
+               p += sizeof(nd_ipv6);
                break;
        default:
                ND_PRINT(" %u/", EXTRACT_BE_U_4(ap->family));
-               for (i = 0; i < l; i++)
-                       ND_PRINT("%02x", *p++);
+               for (i = 0; i < l; i++) {
+                       ND_PRINT("%02x", EXTRACT_U_1(p));
+                       p++;
+               }
        }
 
        return p - p0;
@@ -309,6 +315,7 @@ lwres_print(netdissect_options *ndo,
        int advance;
        int unsupported = 0;
 
+       ndo->ndo_protocol = "lwres";
        np = (const struct lwres_lwpacket *)bp;
        ND_TCHECK_2(np->authlength);
 
@@ -595,5 +602,5 @@ lwres_print(netdissect_options *ndo,
        return;
 
   trunc:
-       ND_PRINT("[|lwres]");
+       nd_print_trunc(ndo);
 }