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/netinet | |
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/netinet')
-rw-r--r-- | sys/netinet/in.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c index a611aae8f0c..d894227e95d 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in.c,v 1.69 2011/10/13 18:23:40 claudio Exp $ */ +/* $OpenBSD: in.c,v 1.70 2012/01/03 23:41:51 bluhm Exp $ */ /* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */ /* @@ -337,8 +337,7 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp) case SIOCSIFBRDADDR: if ((ifp->if_flags & IFF_BROADCAST) == 0) return (EINVAL); - ifa_update_broadaddr(ifp, (struct ifaddr *)ia, - &ifr->ifr_broadaddr); + ifa_update_broadaddr(ifp, &ia->ia_ifa, &ifr->ifr_broadaddr); break; case SIOCSIFADDR: @@ -389,7 +388,7 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp) if (newifaddr) ia->ia_broadaddr = ifra->ifra_broadaddr; else - ifa_update_broadaddr(ifp, (struct ifaddr *)ia, + ifa_update_broadaddr(ifp, &ia->ia_ifa, sintosa(&ifra->ifra_broadaddr)); } if (ifra->ifra_addr.sin_family == AF_INET && @@ -419,7 +418,7 @@ cleanup: s = splsoftnet(); in_ifscrub(ifp, ia); if (!error) - ifa_del(ifp, (struct ifaddr *)ia); + ifa_del(ifp, &ia->ia_ifa); TAILQ_REMOVE(&in_ifaddr, ia, ia_list); if (ia->ia_allhosts != NULL) { in_delmulti(ia->ia_allhosts); @@ -651,7 +650,7 @@ in_ifinit(struct ifnet *ifp, struct in_ifaddr *ia, struct sockaddr_in *sin, int s = splnet(), flags = RTF_UP, error; if (!newaddr) - ifa_del(ifp, (struct ifaddr *)ia); + ifa_del(ifp, &ia->ia_ifa); oldaddr = ia->ia_addr; ia->ia_addr = *sin; @@ -710,7 +709,7 @@ in_ifinit(struct ifnet *ifp, struct in_ifaddr *ia, struct sockaddr_in *sin, flags |= RTF_HOST; } else if (ifp->if_flags & IFF_POINTOPOINT) { if (ia->ia_dstaddr.sin_family != AF_INET) { - ifa_add(ifp, (struct ifaddr *)ia); + ifa_add(ifp, &ia->ia_ifa); return (0); } flags |= RTF_HOST; @@ -729,7 +728,7 @@ in_ifinit(struct ifnet *ifp, struct in_ifaddr *ia, struct sockaddr_in *sin, } if (!error) - ifa_add(ifp, (struct ifaddr *)ia); + ifa_add(ifp, &ia->ia_ifa); return (error); } |