diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2012-01-03 23:41:52 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2012-01-03 23:41:52 +0000 |
commit | a788b08e4a13f160295ff1c5ed5f72c192a31c6d (patch) | |
tree | 96ea4a06a86ec5229ca9811399a22cc423377398 /sys/netinet6 | |
parent | 8390485057fcecbd0fa623e72550abc20f2293e8 (diff) |
To access the ifaddr of an in_ifaddr or in6_ifaddr struct, it is
cleaner to access the first member via ia_ifa instead of casting.
No binary change.
ok henning@ krw@
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/in6.c | 6 | ||||
-rw-r--r-- | sys/netinet6/in6_ifattach.c | 4 | ||||
-rw-r--r-- | sys/netinet6/nd6.c | 6 | ||||
-rw-r--r-- | sys/netinet6/nd6_nbr.c | 16 | ||||
-rw-r--r-- | sys/netinet6/nd6_rtr.c | 8 |
5 files changed, 20 insertions, 20 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 99535f54698..cd66d7a54f9 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.94 2011/11/24 17:39:55 sperreault Exp $ */ +/* $OpenBSD: in6.c,v 1.95 2012/01/03 23:41:51 bluhm Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -1205,7 +1205,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, if (hostIsNew && in6if_do_dad(ifp) && (ifra->ifra_flags & IN6_IFF_NODAD) == 0) { - nd6_dad_start((struct ifaddr *)ia, NULL); + nd6_dad_start(&ia->ia_ifa, NULL); } return (error); @@ -1406,7 +1406,7 @@ in6_lifaddr_ioctl(struct socket *so, u_long cmd, caddr_t data, * address. hostid points to the first link-local * address attached to the interface. */ - ifa = (struct ifaddr *)in6ifa_ifpforlinklocal(ifp, 0); + ifa = &in6ifa_ifpforlinklocal(ifp, 0)->ia_ifa; if (!ifa) return EADDRNOTAVAIL; hostid = IFA_IN6(ifa); diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index 1a7d1b4c28e..96918584081 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_ifattach.c,v 1.52 2011/11/24 17:39:55 sperreault Exp $ */ +/* $OpenBSD: in6_ifattach.c,v 1.53 2012/01/03 23:41:51 bluhm Exp $ */ /* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */ /* @@ -719,7 +719,7 @@ in6_ifdetach(struct ifnet *ifp) } /* remove from the linked list */ - ifa_del(ifp, (struct ifaddr *)ia); + ifa_del(ifp, &ia->ia_ifa); IFAFREE(&ia->ia_ifa); /* also remove from the IPv6 address chain(itojun&jinmei) */ diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 28cf0fa6f92..f995e27c38f 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.c,v 1.90 2011/12/27 17:20:04 bluhm Exp $ */ +/* $OpenBSD: nd6.c,v 1.91 2012/01/03 23:41:51 bluhm Exp $ */ /* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */ /* @@ -1175,8 +1175,8 @@ nd6_rtrequest(int req, struct rtentry *rt, struct rt_addrinfo *info) * check if rt_key(rt) is one of my address assigned * to the interface. */ - ifa = (struct ifaddr *)in6ifa_ifpwithaddr(rt->rt_ifp, - &SIN6(rt_key(rt))->sin6_addr); + ifa = &in6ifa_ifpwithaddr(rt->rt_ifp, + &SIN6(rt_key(rt))->sin6_addr)->ia_ifa; if (ifa) { caddr_t macp = nd6_ifptomac(ifp); nd6_llinfo_settimer(ln, -1); diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index e1a497c4c5a..530e239f590 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_nbr.c,v 1.60 2011/11/24 17:39:55 sperreault Exp $ */ +/* $OpenBSD: nd6_nbr.c,v 1.61 2012/01/03 23:41:51 bluhm Exp $ */ /* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */ /* @@ -183,7 +183,7 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) * We do not add one in MUST NOT cases. */ #if 0 /* too much! */ - ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &daddr6); + ifa = &in6ifa_ifpwithaddr(ifp, &daddr6)->ia_ifa; if (ifa && (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_ANYCAST)) tlladdr = 0; else @@ -202,14 +202,14 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) /* (1) and (3) check. */ #if NCARP > 0 if (ifp->if_type == IFT_CARP) { - ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &taddr6); + ifa = &in6ifa_ifpwithaddr(ifp, &taddr6)->ia_ifa; if (ifa && !carp_iamatch6(ifp, lladdr, &proxydl)) ifa = NULL; } else { - ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &taddr6); + ifa = &in6ifa_ifpwithaddr(ifp, &taddr6)->ia_ifa; } #else - ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &taddr6); + ifa = &in6ifa_ifpwithaddr(ifp, &taddr6)->ia_ifa; #endif /* (2) check. */ @@ -229,8 +229,8 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) /* * proxy NDP for single entry */ - ifa = (struct ifaddr *)in6ifa_ifpforlinklocal(ifp, - IN6_IFF_NOTREADY|IN6_IFF_ANYCAST); + ifa = &in6ifa_ifpforlinklocal(ifp, + IN6_IFF_NOTREADY | IN6_IFF_ANYCAST)->ia_ifa; if (ifa) { proxy = 1; proxydl = SDL(rt->rt_gateway); @@ -615,7 +615,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) lladdrlen = ndopts.nd_opts_tgt_lladdr->nd_opt_len << 3; } - ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &taddr6); + ifa = &in6ifa_ifpwithaddr(ifp, &taddr6)->ia_ifa; /* * Target address matches one of my interface address. diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 16591e8be83..5de5cf77fca 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_rtr.c,v 1.57 2011/12/27 17:20:04 bluhm Exp $ */ +/* $OpenBSD: nd6_rtr.c,v 1.58 2012/01/03 23:41:51 bluhm Exp $ */ /* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */ /* @@ -1568,8 +1568,8 @@ nd6_prefix_onlink(struct nd_prefix *pr) * We prefer link-local addresses as the associated interface address. */ /* search for a link-local addr */ - ifa = (struct ifaddr *)in6ifa_ifpforlinklocal(ifp, - IN6_IFF_NOTREADY | IN6_IFF_ANYCAST); + ifa = &in6ifa_ifpforlinklocal(ifp, + IN6_IFF_NOTREADY | IN6_IFF_ANYCAST)->ia_ifa; if (ifa == NULL) { /* XXX: freebsd does not have ifa_ifwithaf */ TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { @@ -1768,7 +1768,7 @@ in6_ifadd(struct nd_prefix *pr) * with the same interface identifier, than to have multiple addresses * with different interface identifiers. */ - ifa = (struct ifaddr *)in6ifa_ifpforlinklocal(ifp, 0); /* 0 is OK? */ + ifa = &in6ifa_ifpforlinklocal(ifp, 0)->ia_ifa; /* 0 is OK? */ if (ifa) ib = (struct in6_ifaddr *)ifa; else |