diff options
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/in.c | 13 | ||||
-rw-r--r-- | sys/netinet/in.h | 8 | ||||
-rw-r--r-- | sys/netinet/ip_ipip.c | 5 | ||||
-rw-r--r-- | sys/netinet/tcp_subr.c | 5 |
4 files changed, 14 insertions, 17 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c index dfbc491ed26..7a20e768887 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in.c,v 1.136 2017/03/27 09:38:03 rzalamena Exp $ */ +/* $OpenBSD: in.c,v 1.137 2017/05/04 15:00:24 bluhm Exp $ */ /* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */ /* @@ -434,13 +434,13 @@ in_lifaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged) case SIOCALIFADDR: case SIOCDLIFADDR: /* address must be specified on ADD and DELETE */ - sa = (struct sockaddr *)&iflr->addr; + sa = sstosa(&iflr->addr); if (sa->sa_family != AF_INET) return EINVAL; if (sa->sa_len != sizeof(struct sockaddr_in)) return EINVAL; /* XXX need improvement */ - sa = (struct sockaddr *)&iflr->dstaddr; + sa = sstosa(&iflr->dstaddr); if (sa->sa_family && sa->sa_family != AF_INET) return EINVAL; @@ -471,12 +471,11 @@ in_lifaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged) memcpy(ifra.ifra_name, iflr->iflr_name, sizeof(ifra.ifra_name)); - memcpy(&ifra.ifra_addr, &iflr->addr, - ((struct sockaddr *)&iflr->addr)->sa_len); + memcpy(&ifra.ifra_addr, &iflr->addr, iflr->addr.ss_len); - if (((struct sockaddr *)&iflr->dstaddr)->sa_family) { /*XXX*/ + if (iflr->dstaddr.ss_family) { /*XXX*/ memcpy(&ifra.ifra_dstaddr, &iflr->dstaddr, - ((struct sockaddr *)&iflr->dstaddr)->sa_len); + iflr->dstaddr.ss_len); } ifra.ifra_mask.sin_family = AF_INET; diff --git a/sys/netinet/in.h b/sys/netinet/in.h index ab2c9ca63b9..aae85fc430a 100644 --- a/sys/netinet/in.h +++ b/sys/netinet/in.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in.h,v 1.121 2017/02/04 02:54:33 guenther Exp $ */ +/* $OpenBSD: in.h,v 1.122 2017/05/04 15:00:24 bluhm Exp $ */ /* $NetBSD: in.h,v 1.20 1996/02/13 23:41:47 christos Exp $ */ /* @@ -834,19 +834,19 @@ const char *sockaddr_ntop(struct sockaddr *, char *, size_t); * casts or defines. */ -static __inline struct sockaddr_in * +static inline struct sockaddr_in * satosin(struct sockaddr *sa) { return ((struct sockaddr_in *)(sa)); } -static __inline struct sockaddr * +static inline struct sockaddr * sintosa(struct sockaddr_in *sin) { return ((struct sockaddr *)(sin)); } -static __inline struct in_ifaddr * +static inline struct in_ifaddr * ifatoia(struct ifaddr *ifa) { return ((struct in_ifaddr *)(ifa)); diff --git a/sys/netinet/ip_ipip.c b/sys/netinet/ip_ipip.c index 45e6e3722d3..8b4b0c54609 100644 --- a/sys/netinet/ip_ipip.c +++ b/sys/netinet/ip_ipip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipip.c,v 1.74 2017/04/14 20:46:31 bluhm Exp $ */ +/* $OpenBSD: ip_ipip.c,v 1.75 2017/05/04 15:00:24 bluhm Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -294,8 +294,7 @@ ipip_input(struct mbuf **mp, int *offp, struct ifnet *gifp, int proto) sin6->sin6_addr = ip6->ip6_src; #endif /* INET6 */ } - rt = rtalloc((struct sockaddr *)&ss, 0, - m->m_pkthdr.ph_rtableid); + rt = rtalloc(sstosa(&ss), 0, m->m_pkthdr.ph_rtableid); if ((rt != NULL) && (rt->rt_flags & RTF_LOCAL)) { ipipstat_inc(ipips_spoof); m_freem(m); diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 931b8ec3d59..d3d33fec7a0 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_subr.c,v 1.161 2017/04/19 15:21:54 bluhm Exp $ */ +/* $OpenBSD: tcp_subr.c,v 1.162 2017/05/04 15:00:24 bluhm Exp $ */ /* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */ /* @@ -694,8 +694,7 @@ tcp6_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *d) * payload. */ inp = in6_pcbhashlookup(&tcbtable, &sa6->sin6_addr, - th.th_dport, (struct in6_addr *)&sa6_src->sin6_addr, - th.th_sport, rdomain); + th.th_dport, &sa6_src->sin6_addr, th.th_sport, rdomain); if (cmd == PRC_MSGSIZE) { /* * Depending on the value of "valid" and routing table |