summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2013-03-04 14:42:26 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2013-03-04 14:42:26 +0000
commit276ad209008bb044f71bd23372b571b28367273e (patch)
treed3668ce4cf2e74024b62d997682bad295f31b37b /sys
parentead282c6b876a48dc12d77e3496fb775d84d225a (diff)
Replace the cast to struct in6_ifaddr pointer with the ifatoia6() macro.
No binary change. OK claudio@
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet6/frag6.c4
-rw-r--r--sys/netinet6/icmp6.c6
-rw-r--r--sys/netinet6/in6.c10
-rw-r--r--sys/netinet6/in6_ifattach.c4
-rw-r--r--sys/netinet6/in6_pcb.c4
-rw-r--r--sys/netinet6/in6_src.c8
-rw-r--r--sys/netinet6/ip6_input.c4
-rw-r--r--sys/netinet6/ip6_output.c4
-rw-r--r--sys/netinet6/nd6_nbr.c23
-rw-r--r--sys/netinet6/nd6_rtr.c12
-rw-r--r--sys/netinet6/raw_ip6.c4
11 files changed, 41 insertions, 42 deletions
diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c
index 5ddcedb2e8b..c14946dcb9d 100644
--- a/sys/netinet6/frag6.c
+++ b/sys/netinet6/frag6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frag6.c,v 1.43 2012/12/28 17:52:06 gsoares Exp $ */
+/* $OpenBSD: frag6.c,v 1.44 2013/03/04 14:42:25 bluhm Exp $ */
/* $KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $ */
/*
@@ -197,7 +197,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
rtalloc_mpath((struct route *)&ro, &ip6->ip6_src.s6_addr32[0]);
if (ro.ro_rt != NULL && ro.ro_rt->rt_ifa != NULL)
- dstifp = ((struct in6_ifaddr *)ro.ro_rt->rt_ifa)->ia_ifp;
+ dstifp = ifatoia6(ro.ro_rt->rt_ifa)->ia_ifp;
if (ro.ro_rt != NULL) {
RTFREE(ro.ro_rt);
ro.ro_rt = NULL;
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index c624da2ff4a..09c078bab34 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp6.c,v 1.118 2012/04/03 14:58:45 mikeb Exp $ */
+/* $OpenBSD: icmp6.c,v 1.119 2013/03/04 14:42:25 bluhm Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@@ -1683,7 +1683,7 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, struct mbuf *m, struct ifnet **ifpp,
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
- ifa6 = (struct in6_ifaddr *)ifa;
+ ifa6 = ifatoia6(ifa);
if ((niflags & NI_NODEADDR_FLAG_ALL) == 0 &&
IN6_ARE_ADDR_EQUAL(&subj_ip6->sin6_addr,
@@ -1761,7 +1761,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *ni6, struct icmp6_nodeinfo *nni6,
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
- ifa6 = (struct in6_ifaddr *)ifa;
+ ifa6 = ifatoia6(ifa);
if ((ifa6->ia6_flags & IN6_IFF_DEPRECATED) != 0 &&
allow_deprecated == 0) {
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 7c56bf11303..f1916ff4469 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.c,v 1.103 2013/03/04 14:23:35 bluhm Exp $ */
+/* $OpenBSD: in6.c,v 1.104 2013/03/04 14:42:25 bluhm Exp $ */
/* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */
/*
@@ -1864,7 +1864,7 @@ in6ifa_ifpforlinklocal(struct ifnet *ifp, int ignoreflags)
}
}
- return ((struct in6_ifaddr *)ifa);
+ return (ifatoia6(ifa));
}
@@ -1885,7 +1885,7 @@ in6ifa_ifpwithaddr(struct ifnet *ifp, struct in6_addr *addr)
break;
}
- return ((struct in6_ifaddr *)ifa);
+ return (ifatoia6(ifa));
}
/*
@@ -2197,7 +2197,7 @@ in6_ifawithscope(struct ifnet *oifp, struct in6_addr *dst, u_int rdomain)
dscopecmp,
ifa_best ? IN6_ARE_SCOPE_CMP(src_scope, best_scope) : -1,
in6_matchlen(IFA_IN6(ifa), dst),
- ((struct in6_ifaddr *)ifa)->ia6_flags);
+ ifatoia6(ifa)->ia6_flags);
#endif
/*
@@ -2378,7 +2378,7 @@ in6_ifawithscope(struct ifnet *oifp, struct in6_addr *dst, u_int rdomain)
continue; /* (b) */
replace:
- ifa_best = (struct in6_ifaddr *)ifa;
+ ifa_best = ifatoia6(ifa);
blen = tlen >= 0 ? tlen :
in6_matchlen(IFA_IN6(ifa), dst);
best_scope = in6_addrscope(&ifa_best->ia_addr.sin6_addr);
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c
index 4cf9d71edc4..2759bc34cd4 100644
--- a/sys/netinet6/in6_ifattach.c
+++ b/sys/netinet6/in6_ifattach.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_ifattach.c,v 1.56 2012/09/19 09:47:25 bluhm Exp $ */
+/* $OpenBSD: in6_ifattach.c,v 1.57 2013/03/04 14:42:25 bluhm Exp $ */
/* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */
/*
@@ -681,7 +681,7 @@ in6_ifdetach(struct ifnet *ifp)
continue;
}
- ia = (struct in6_ifaddr *)ifa;
+ ia = ifatoia6(ifa);
/*
* leave from multicast groups we have joined for the interface
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index c0fb81ec6f5..acf98f22a99 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_pcb.c,v 1.50 2011/11/24 17:39:55 sperreault Exp $ */
+/* $OpenBSD: in6_pcb.c,v 1.51 2013/03/04 14:42:25 bluhm Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -253,7 +253,7 @@ in6_pcbbind(struct inpcb *inp, struct mbuf *nam, struct proc *p)
* deprecated addresses (default: forbid bind(2)).
*/
if (ia &&
- ((struct in6_ifaddr *)ia)->ia6_flags &
+ ifatoia6(ia)->ia6_flags &
(IN6_IFF_ANYCAST|IN6_IFF_NOTREADY|IN6_IFF_DETACHED))
return (EADDRNOTAVAIL);
}
diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c
index 4182737d9ab..e46678d79b0 100644
--- a/sys/netinet6/in6_src.c
+++ b/sys/netinet6/in6_src.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_src.c,v 1.27 2011/11/24 17:39:55 sperreault Exp $ */
+/* $OpenBSD: in6_src.c,v 1.28 2013/03/04 14:42:25 bluhm Exp $ */
/* $KAME: in6_src.c,v 1.36 2001/02/06 04:08:17 itojun Exp $ */
/*
@@ -104,7 +104,7 @@ in6_selectsrc(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
int *errorp, u_int rtableid)
{
struct in6_addr *dst;
- struct in6_ifaddr *ia6 = 0;
+ struct in6_ifaddr *ia6 = NULL;
struct in6_pktinfo *pi = NULL;
dst = &dstsock->sin6_addr;
@@ -134,8 +134,8 @@ in6_selectsrc(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
if (ifp && IN6_IS_SCOPE_EMBED(&sa6.sin6_addr))
sa6.sin6_addr.s6_addr16[1] = htons(ifp->if_index);
- ia6 = (struct in6_ifaddr *)
- ifa_ifwithaddr((struct sockaddr *)&sa6, rtableid);
+ ia6 = ifatoia6(
+ ifa_ifwithaddr((struct sockaddr *)&sa6, rtableid));
if (ia6 == NULL ||
(ia6->ia6_flags & (IN6_IFF_ANYCAST | IN6_IFF_NOTREADY))) {
*errorp = EADDRNOTAVAIL;
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index e45b80885d0..c7b7f44719d 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_input.c,v 1.105 2012/11/06 12:32:42 henning Exp $ */
+/* $OpenBSD: ip6_input.c,v 1.106 2013/03/04 14:42:25 bluhm Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -488,7 +488,7 @@ ip6_input(struct mbuf *m)
#endif
ip6_forward_rt.ro_rt->rt_ifp->if_type == IFT_LOOP) {
struct in6_ifaddr *ia6 =
- (struct in6_ifaddr *)ip6_forward_rt.ro_rt->rt_ifa;
+ ifatoia6(ip6_forward_rt.ro_rt->rt_ifa);
if (ia6->ia6_flags & IN6_IFF_ANYCAST)
isanycast = 1;
/*
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index cc271fe7cf4..10cee335752 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_output.c,v 1.132 2012/11/06 12:32:42 henning Exp $ */
+/* $OpenBSD: ip6_output.c,v 1.133 2013/03/04 14:42:25 bluhm Exp $ */
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
/*
@@ -588,7 +588,7 @@ reroute:
* then rt (for unicast) and ifp must be non-NULL valid values.
*/
if (rt) {
- ia = (struct in6_ifaddr *)(rt->rt_ifa);
+ ia = ifatoia6(rt->rt_ifa);
rt->rt_use++;
}
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index 95b0e107d3d..d177cb0becc 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_nbr.c,v 1.64 2013/03/03 00:35:14 bluhm Exp $ */
+/* $OpenBSD: nd6_nbr.c,v 1.65 2013/03/04 14:42:25 bluhm Exp $ */
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
/*
@@ -184,7 +184,7 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len)
*/
#if 0 /* too much! */
ifa = &in6ifa_ifpwithaddr(ifp, &daddr6)->ia_ifa;
- if (ifa && (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_ANYCAST))
+ if (ifa && (ifatoia6(ifa)->ia6_flags & IN6_IFF_ANYCAST))
tlladdr = 0;
else
#endif
@@ -244,9 +244,9 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len)
goto freeit;
}
myaddr6 = *IFA_IN6(ifa);
- anycast = ((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_ANYCAST;
- tentative = ((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_TENTATIVE;
- if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_DUPLICATED)
+ anycast = ifatoia6(ifa)->ia6_flags & IN6_IFF_ANYCAST;
+ tentative = ifatoia6(ifa)->ia6_flags & IN6_IFF_TENTATIVE;
+ if (ifatoia6(ifa)->ia6_flags & IN6_IFF_DUPLICATED)
goto freeit;
if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) {
@@ -635,8 +635,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len)
*
* Otherwise, process as defined in RFC 2461.
*/
- if (ifa
- && (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_TENTATIVE)) {
+ if (ifa && (ifatoia6(ifa)->ia6_flags & IN6_IFF_TENTATIVE)) {
nd6_dad_na_input(ifa);
goto freeit;
}
@@ -1105,7 +1104,7 @@ nd6_dad_stoptimer(struct dadq *dp)
void
nd6_dad_start(struct ifaddr *ifa, int *tick)
{
- struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa;
+ struct in6_ifaddr *ia = ifatoia6(ifa);
struct dadq *dp;
if (!dad_init) {
@@ -1216,7 +1215,7 @@ void
nd6_dad_timer(struct ifaddr *ifa)
{
int s;
- struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa;
+ struct in6_ifaddr *ia = ifatoia6(ifa);
struct dadq *dp;
s = splsoftnet(); /* XXX */
@@ -1320,7 +1319,7 @@ done:
void
nd6_dad_duplicated(struct ifaddr *ifa)
{
- struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa;
+ struct in6_ifaddr *ia = ifatoia6(ifa);
struct dadq *dp;
dp = nd6_dad_find(ifa);
@@ -1355,7 +1354,7 @@ nd6_dad_duplicated(struct ifaddr *ifa)
void
nd6_dad_ns_output(struct dadq *dp, struct ifaddr *ifa)
{
- struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa;
+ struct in6_ifaddr *ia = ifatoia6(ifa);
struct ifnet *ifp = ifa->ifa_ifp;
dp->dad_ns_tcount++;
@@ -1387,7 +1386,7 @@ nd6_dad_ns_input(struct ifaddr *ifa)
if (!ifa)
panic("ifa == NULL in nd6_dad_ns_input");
- ia = (struct in6_ifaddr *)ifa;
+ ia = ifatoia6(ifa);
taddr6 = &ia->ia_addr.sin6_addr;
duplicate = 0;
dp = nd6_dad_find(ifa);
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
index 32e8246e366..953911309c0 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_rtr.c,v 1.65 2012/09/26 14:53:23 markus Exp $ */
+/* $OpenBSD: nd6_rtr.c,v 1.66 2013/03/04 14:42:25 bluhm Exp $ */
/* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */
/*
@@ -913,7 +913,7 @@ purge_detached(struct ifnet *ifp)
ifa_next = ifa->ifa_list.tqe_next;
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
- ia = (struct in6_ifaddr *)ifa;
+ ia = ifatoia6(ifa);
if ((ia->ia6_flags & IN6_IFF_AUTOCONF) ==
IN6_IFF_AUTOCONF && ia->ia6_ndpr == pr) {
in6_purgeaddr(ifa);
@@ -1166,7 +1166,7 @@ prelist_update(struct nd_prefix *new, struct nd_defrouter *dr, struct mbuf *m)
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
- ifa6 = (struct in6_ifaddr *)ifa;
+ ifa6 = ifatoia6(ifa);
/*
* Spec is not clear here, but I believe we should concentrate
@@ -1315,7 +1315,7 @@ nd6_addr_add(void *prptr, void *arg2)
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
- ia6 = (struct in6_ifaddr *)ifa;
+ ia6 = ifatoia6(ifa);
/*
* Spec is not clear here, but I believe we should concentrate
@@ -1797,13 +1797,13 @@ in6_ifadd(struct nd_prefix *pr, int privacy)
*/
ifa = &in6ifa_ifpforlinklocal(ifp, 0)->ia_ifa; /* 0 is OK? */
if (ifa)
- ib = (struct in6_ifaddr *)ifa;
+ ib = ifatoia6(ifa);
else
return NULL;
#if 0 /* don't care link local addr state, and always do DAD */
/* if link-local address is not eligible, do not autoconfigure. */
- if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_NOTREADY) {
+ if (ifatoia6(ifa)->ia6_flags & IN6_IFF_NOTREADY) {
printf("in6_ifadd: link-local address not ready\n");
return NULL;
}
diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c
index ef353fec29a..5324603a6cf 100644
--- a/sys/netinet6/raw_ip6.c
+++ b/sys/netinet6/raw_ip6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip6.c,v 1.45 2012/10/21 13:06:03 benno Exp $ */
+/* $OpenBSD: raw_ip6.c,v 1.46 2013/03/04 14:42:25 bluhm Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
@@ -718,7 +718,7 @@ rip6_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
error = EADDRNOTAVAIL;
break;
}
- if (ia && ((struct in6_ifaddr *)ia)->ia6_flags &
+ if (ia && ifatoia6(ia)->ia6_flags &
(IN6_IFF_ANYCAST|IN6_IFF_NOTREADY|
IN6_IFF_DETACHED|IN6_IFF_DEPRECATED)) {
error = EADDRNOTAVAIL;