summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2013-03-28 12:06:55 +0000
committermpi <mpi@openbsd.org>2013-03-28 12:06:55 +0000
commit3409bfb9cbe7ab24e5227c894ccfe68b44fb20ec (patch)
tree1c33d883cb16460df01b7cafeef017a6bb2151d2
parentadd i915_gem_execbuffer_reserve_object and friends and move (diff)
downloadwireguard-openbsd-3409bfb9cbe7ab24e5227c894ccfe68b44fb20ec.tar.xz
wireguard-openbsd-3409bfb9cbe7ab24e5227c894ccfe68b44fb20ec.zip
Replace some casts to struct in_ifaddr pointer by ifatoia() or NULL.
ok millert@, haesbaert@, bluhm@
-rw-r--r--sys/net/if.c8
-rw-r--r--sys/netinet/in_pcb.c5
-rw-r--r--sys/netinet/ip_input.c9
3 files changed, 9 insertions, 13 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 19ea4bfb961..6ee536f7ed9 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.253 2013/03/26 13:19:25 mpi Exp $ */
+/* $OpenBSD: if.c,v 1.254 2013/03/28 12:06:55 mpi Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -607,8 +607,7 @@ do { \
ifa_del(ifp, ifa);
#ifdef INET
if (ifa->ifa_addr->sa_family == AF_INET)
- TAILQ_REMOVE(&in_ifaddr, (struct in_ifaddr *)ifa,
- ia_list);
+ TAILQ_REMOVE(&in_ifaddr, ifatoia(ifa), ia_list);
#endif
/* XXX if_free_sadl needs this */
if (ifa == ifnet_addrs[ifp->if_index])
@@ -1508,8 +1507,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p)
if (ifa->ifa_addr->sa_family != AF_INET)
continue;
- TAILQ_REMOVE(&in_ifaddr,
- (struct in_ifaddr *)ifa, ia_list);
+ TAILQ_REMOVE(&in_ifaddr, ifatoia(ifa), ia_list);
ifa_del(ifp, ifa);
ifa->ifa_ifp = NULL;
ifafree(ifa);
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index cc83efeafbf..b0882f574bb 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.c,v 1.132 2013/03/28 00:32:11 bluhm Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.133 2013/03/28 12:06:55 mpi Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@@ -789,9 +789,8 @@ in_selectsrc(struct sockaddr_in *sin, struct route *ro, int soopts,
struct ip_moptions *mopts, int *errorp, u_int rtableid)
{
struct sockaddr_in *sin2;
- struct in_ifaddr *ia;
+ struct in_ifaddr *ia = NULL;
- ia = (struct in_ifaddr *)0;
/*
* If the destination address is multicast and an outgoing
* interface has been set as a multicast option, use the
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 3d8f38a3137..7c7aa4924e2 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_input.c,v 1.203 2013/03/28 00:32:11 bluhm Exp $ */
+/* $OpenBSD: ip_input.c,v 1.204 2013/03/28 12:06:55 mpi Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@@ -688,8 +688,7 @@ in_ouraddr(struct in_addr ina, struct mbuf *m)
sin.sin_len = sizeof(sin);
sin.sin_family = AF_INET;
sin.sin_addr = ina;
- ia = (struct in_ifaddr *)ifa_ifwithaddr(sintosa(&sin),
- m->m_pkthdr.rdomain);
+ ia = ifatoia(ifa_ifwithaddr(sintosa(&sin), m->m_pkthdr.rdomain));
if (ia == NULL) {
/*
@@ -745,7 +744,7 @@ in_iawithaddr(struct in_addr ina, u_int rdomain)
sin.sin_len = sizeof(sin);
sin.sin_family = AF_INET;
sin.sin_addr = ina;
- ia = (struct in_ifaddr *)ifa_ifwithaddr(sintosa(&sin), rdomain);
+ ia = ifatoia(ifa_ifwithaddr(sintosa(&sin), rdomain));
if (ia == NULL || ina.s_addr == ia->ia_addr.sin_addr.s_addr)
return (ia);
@@ -1256,7 +1255,7 @@ ip_rtaddr(struct in_addr dst, u_int rtableid)
rtableid);
}
if (ipforward_rt.ro_rt == 0)
- return ((struct in_ifaddr *)0);
+ return (NULL);
return (ifatoia(ipforward_rt.ro_rt->rt_ifa));
}