Use nd_ipv6 rather than struct in6_addr

This commit is contained in:
Francois-Xavier Le Bail 2019-06-10 15:32:20 +02:00
parent 6fc5b4200b
commit 0c9cfdcb0d
9 changed files with 24 additions and 24 deletions

View 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);
/*

View 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 */

View 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)));
}

View 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;

View 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;

View 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);

View 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;

View 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) */
};

View 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;
};