]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Use nd_ipv6 rather than struct in6_addr
authorFrancois-Xavier Le Bail <[email protected]>
Mon, 10 Jun 2019 13:32:20 +0000 (15:32 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Mon, 10 Jun 2019 13:32:20 +0000 (15:32 +0200)
addrtoname.c
print-bgp.c
print-domain.c
print-esp.c
print-icmp6.c
print-ip6.c
print-isakmp.c
print-nfs.c
print-tcp.c

index 1c80c39f0e7891f9244c3266da54787aff606c20..8e834d52fe6fd69f2f8ee8fb9edfc229a9cb85ae 100644 (file)
@@ -184,7 +184,7 @@ win32_gethostbyaddr(const char *addr, int len, int type)
 #endif /* _WIN32 */
 
 struct h6namemem {
-       struct in6_addr addr;
+       nd_ipv6 addr;
        char *name;
        struct h6namemem *nxt;
 };
@@ -346,7 +346,7 @@ ip6addr_string(netdissect_options *ndo, const u_char *ap)
 {
        struct hostent *hp;
        union {
-               struct in6_addr addr;
+               nd_ipv6 addr;
                struct for_hash_addr {
                        char fill[14];
                        uint16_t d;
@@ -362,7 +362,7 @@ ip6addr_string(netdissect_options *ndo, const u_char *ap)
                if (memcmp(&p->addr, &addr, sizeof(addr)) == 0)
                        return (p->name);
        }
-       p->addr = addr.addr;
+       memcpy(p->addr, addr.addr, sizeof(nd_ipv6));
        p->nxt = newh6namemem(ndo);
 
        /*
index 94de6757c0c3b7271f2b0b6013e756f35cbe975b..85a82ef4770d9a2901b3df598499d11532638992 100644 (file)
@@ -1233,7 +1233,7 @@ int
 decode_prefix6(netdissect_options *ndo,
                const u_char *pd, u_int itemlen, char *buf, size_t buflen)
 {
-    struct in6_addr addr;
+    nd_ipv6 addr;
     u_int plen, plenbytes;
 
     ND_TCHECK_1(pd);
@@ -1249,7 +1249,7 @@ decode_prefix6(netdissect_options *ndo,
     ITEMCHECK(plenbytes);
     memcpy(&addr, pd + 1, plenbytes);
     if (plen % 8) {
-        addr.s6_addr[plenbytes - 1] &=
+        addr[plenbytes - 1] &=
             ((0xff00 >> (plen % 8)) & 0xff);
     }
     nd_snprintf(buf, buflen, "%s/%u", ip6addr_string(ndo, (const u_char *)&addr), plen);
@@ -1266,7 +1266,7 @@ static int
 decode_labeled_prefix6(netdissect_options *ndo,
                const u_char *pptr, u_int itemlen, char *buf, size_t buflen)
 {
-    struct in6_addr addr;
+    nd_ipv6 addr;
     u_int plen, plenbytes;
 
     /* prefix length and label = 4 bytes */
@@ -1288,7 +1288,7 @@ decode_labeled_prefix6(netdissect_options *ndo,
     ND_TCHECK_LEN(pptr + 4, plenbytes);
     memcpy(&addr, pptr + 4, plenbytes);
     if (plen % 8) {
-        addr.s6_addr[plenbytes - 1] &=
+        addr[plenbytes - 1] &=
             ((0xff00 >> (plen % 8)) & 0xff);
     }
     /* the label may get offsetted by 4 bits so lets shift it right */
@@ -1311,7 +1311,7 @@ static int
 decode_labeled_vpn_prefix6(netdissect_options *ndo,
                            const u_char *pptr, char *buf, size_t buflen)
 {
-    struct in6_addr addr;
+    nd_ipv6 addr;
     u_int plen;
 
     ND_TCHECK_1(pptr);
@@ -1329,7 +1329,7 @@ decode_labeled_vpn_prefix6(netdissect_options *ndo,
     ND_TCHECK_LEN(pptr + 12, (plen + 7) / 8);
     memcpy(&addr, pptr + 12, (plen + 7) / 8);
     if (plen % 8) {
-        addr.s6_addr[(plen + 7) / 8 - 1] &=
+        addr[(plen + 7) / 8 - 1] &=
             ((0xff00 >> (plen % 8)) & 0xff);
     }
     /* the label may get offsetted by 4 bits so lets shift it right */
index 97a5fe2021867700d071b36ed6e17e333318239c..63705db5e0fdccea1caad62614a0886fa57f9880 100644 (file)
@@ -526,7 +526,7 @@ ns_rprint(netdissect_options *ndo,
 
        case T_A6:
            {
-               struct in6_addr a;
+               nd_ipv6 a;
                int pbit, pbyte;
                char ntop_buf[INET6_ADDRSTRLEN];
 
@@ -540,8 +540,8 @@ ns_rprint(netdissect_options *ndo,
                } else if (pbit < 128) {
                        if (!ND_TTEST_LEN(cp + 1, sizeof(a) - pbyte))
                                return(NULL);
-                       memset(&a, 0, sizeof(a));
-                       memcpy(&a.s6_addr[pbyte], cp + 1, sizeof(a) - pbyte);
+                       memset(a, 0, sizeof(a));
+                       memcpy(a + pbyte, cp + 1, sizeof(a) - pbyte);
                        ND_PRINT(" %u %s", pbit,
                            addrtostr6(&a, ntop_buf, sizeof(ntop_buf)));
                }
index f30563aa39fea61264491a31d16cf3e5dc29821b..9d8906e5a87340c29c1635c2323f4b15b1c25c0f 100644 (file)
@@ -100,7 +100,7 @@ struct newesp {
 #ifdef HAVE_LIBCRYPTO
 union inaddr_u {
        nd_ipv4 in4;
-       struct in6_addr in6;
+       nd_ipv6 in6;
 };
 struct sa_list {
        struct sa_list  *next;
index c1bce28be8714c5e2fff7c3c0ab4ef4cd91ed1e8..1f0c24ba1b0ef6c96650a2f2a6a6dba718ed70d2 100644 (file)
@@ -1438,7 +1438,7 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid)
        const struct nd_opt_homeagent_info *oph;
        const struct nd_opt_route_info *opri;
        const u_char *cp, *ep, *domp;
-       struct in6_addr in6;
+       nd_ipv6 in6;
        size_t l;
        u_int i;
 
index 15e13c2b4ed9dbc23a30b8b1425a127aa0f48a72..a15206c264545d99b6a90080e152b06a5a161b42 100644 (file)
@@ -44,7 +44,7 @@
  * calculation.
  */
 static void
-ip6_finddst(netdissect_options *ndo, struct in6_addr *dst,
+ip6_finddst(netdissect_options *ndo, nd_ipv6 *dst,
             const struct ip6_hdr *ip6)
 {
        const u_char *cp;
@@ -177,8 +177,8 @@ nextproto6_cksum(netdissect_options *ndo,
                 u_int len, u_int covlen, uint8_t next_proto)
 {
         struct {
-                struct in6_addr ph_src;
-                struct in6_addr ph_dst;
+                nd_ipv6 ph_src;
+                nd_ipv6 ph_dst;
                 uint32_t       ph_len;
                 uint8_t        ph_zero[3];
                 uint8_t        ph_nxt;
@@ -188,7 +188,7 @@ nextproto6_cksum(netdissect_options *ndo,
 
         /* pseudo-header */
         memset(&ph, 0, sizeof(ph));
-        UNALIGNED_MEMCPY(&ph.ph_src, ip6->ip6_src, sizeof (struct in6_addr));
+        UNALIGNED_MEMCPY(&ph.ph_src, ip6->ip6_src, sizeof (nd_ipv6));
         nh = GET_U_1(ip6->ip6_nxt);
         switch (nh) {
 
@@ -208,7 +208,7 @@ nextproto6_cksum(netdissect_options *ndo,
 
         default:
                 UNALIGNED_MEMCPY(&ph.ph_dst, ip6->ip6_dst,
-                                 sizeof (struct in6_addr));
+                                 sizeof (nd_ipv6));
                 break;
         }
         ph.ph_len = htonl(len);
index 664966669503418c7a423421b6c875d5552185e0..8c46bce4c894329d7a98eb3c2942fc4d96dc4537 100644 (file)
@@ -636,7 +636,7 @@ ikev1_print(netdissect_options *ndo,
 static int ninitiator = 0;
 union inaddr_u {
        nd_ipv4 in4;
-       struct in6_addr in6;
+       nd_ipv6 in6;
 };
 static struct {
        cookie_t initiator;
index a6755513e6a1e4af9a3a1b7467911a7180c6ef52..76bbfd3e9914113e16b981ab564e84463d51a381 100644 (file)
@@ -955,8 +955,8 @@ nfs_printfh(netdissect_options *ndo,
 struct xid_map_entry {
        uint32_t        xid;            /* transaction ID (net order) */
        int ipver;                      /* IP version (4 or 6) */
-       struct in6_addr client;         /* client IP address (net order) */
-       struct in6_addr server;         /* server IP address (net order) */
+       nd_ipv6 client;                 /* client IP address (net order) */
+       nd_ipv6 server;                 /* server IP address (net order) */
        uint32_t        proc;           /* call proc number (host order) */
        uint32_t        vers;           /* program version (host order) */
 };
index 58e1aef66da5fd3cfbd95df885ad905589738f6f..d5c5f6d6f5ddebc9534f8996acabb4f3fcc24267 100644 (file)
@@ -81,8 +81,8 @@ struct tcp_seq_hash {
 };
 
 struct tha6 {
-        struct in6_addr src;
-        struct in6_addr dst;
+        nd_ipv6 src;
+        nd_ipv6 dst;
         u_int port;
 };