diff options
-rw-r--r-- | sys/net/if_gif.c | 29 | ||||
-rw-r--r-- | sys/net/if_tun.c | 14 | ||||
-rw-r--r-- | sys/net/pipex.c | 20 | ||||
-rw-r--r-- | sys/net/radix_mpath.c | 6 | ||||
-rw-r--r-- | sys/netinet/in_pcb.c | 4 | ||||
-rw-r--r-- | sys/netinet/ip_divert.c | 5 | ||||
-rw-r--r-- | sys/netinet/ip_icmp.c | 8 | ||||
-rw-r--r-- | sys/netinet/ip_mroute.c | 4 | ||||
-rw-r--r-- | sys/netinet/tcp_subr.c | 5 | ||||
-rw-r--r-- | sys/nfs/nfs_boot.c | 4 |
10 files changed, 47 insertions, 52 deletions
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index f89d0579277..0d4eb4e8663 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gif.c,v 1.77 2015/07/17 18:05:59 mpi Exp $ */ +/* $OpenBSD: if_gif.c,v 1.78 2015/09/01 21:24:04 bluhm Exp $ */ /* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */ /* @@ -339,17 +339,17 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCSLIFPHYADDR: switch (cmd) { case SIOCSIFPHYADDR: - src = (struct sockaddr *) - &(((struct in_aliasreq *)data)->ifra_addr); - dst = (struct sockaddr *) - &(((struct in_aliasreq *)data)->ifra_dstaddr); + src = sintosa( + &(((struct in_aliasreq *)data)->ifra_addr)); + dst = sintosa( + &(((struct in_aliasreq *)data)->ifra_dstaddr)); break; #ifdef INET6 case SIOCSIFPHYADDR_IN6: - src = (struct sockaddr *) - &(((struct in6_aliasreq *)data)->ifra_addr); - dst = (struct sockaddr *) - &(((struct in6_aliasreq *)data)->ifra_dstaddr); + src = sin6tosa( + &(((struct in6_aliasreq *)data)->ifra_addr)); + dst = sin6tosa( + &(((struct in6_aliasreq *)data)->ifra_dstaddr)); break; #endif case SIOCSLIFPHYADDR: @@ -432,10 +432,10 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) /* can't configure multiple multi-dest interfaces */ #define multidest(x) \ - (((struct sockaddr_in *)(x))->sin_addr.s_addr == INADDR_ANY) + (satosin(x)->sin_addr.s_addr == INADDR_ANY) #ifdef INET6 #define multidest6(x) \ - (IN6_IS_ADDR_UNSPECIFIED(&((struct sockaddr_in6 *)(x))->sin6_addr)) + (IN6_IS_ADDR_UNSPECIFIED(&satosin6(x)->sin6_addr)) #endif if (dst->sa_family == AF_INET && multidest(dst) && multidest(sc2->gif_pdst)) { @@ -501,8 +501,8 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; #ifdef INET6 case SIOCGIFPSRCADDR_IN6: - dst = (struct sockaddr *) - &(((struct in6_ifreq *)data)->ifr_addr); + dst = sin6tosa( + &(((struct in6_ifreq *)data)->ifr_addr)); size = sizeof(((struct in6_ifreq *)data)->ifr_addr); break; #endif /* INET6 */ @@ -531,8 +531,7 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; #ifdef INET6 case SIOCGIFPDSTADDR_IN6: - dst = (struct sockaddr *) - &(((struct in6_ifreq *)data)->ifr_addr); + dst = sin6tosa(&(((struct in6_ifreq *)data)->ifr_addr)); size = sizeof(((struct in6_ifreq *)data)->ifr_addr); break; #endif /* INET6 */ diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 31cfdb929db..d0fc0936efa 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tun.c,v 1.152 2015/08/28 15:37:04 reyk Exp $ */ +/* $OpenBSD: if_tun.c,v 1.153 2015/09/01 21:24:04 bluhm Exp $ */ /* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */ /* @@ -444,16 +444,16 @@ tuninit(struct tun_softc *tp) } #ifdef INET6 if (ifa->ifa_addr->sa_family == AF_INET6) { - struct sockaddr_in6 *sin; + struct sockaddr_in6 *sin6; - sin = (struct sockaddr_in6 *)ifa->ifa_addr; - if (!IN6_IS_ADDR_UNSPECIFIED(&sin->sin6_addr)) + sin6 = satosin6(ifa->ifa_addr); + if (!IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) tp->tun_flags |= TUN_IASET; if (ifp->if_flags & IFF_POINTOPOINT) { - sin = (struct sockaddr_in6 *)ifa->ifa_dstaddr; - if (sin && - !IN6_IS_ADDR_UNSPECIFIED(&sin->sin6_addr)) + sin6 = satosin6(ifa->ifa_dstaddr); + if (sin6 && + !IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) tp->tun_flags |= TUN_DSTADDR; } else tp->tun_flags &= ~TUN_DSTADDR; diff --git a/sys/net/pipex.c b/sys/net/pipex.c index f0824593574..9786a23794c 100644 --- a/sys/net/pipex.c +++ b/sys/net/pipex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pipex.c,v 1.73 2015/08/24 14:00:28 bluhm Exp $ */ +/* $OpenBSD: pipex.c,v 1.74 2015/09/01 21:24:04 bluhm Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -2959,10 +2959,9 @@ pipex_sockaddr_hash_key(struct sockaddr *sa) { switch (sa->sa_family) { case AF_INET: - return ntohl(((struct sockaddr_in *)sa)->sin_addr.s_addr); + return ntohl(satosin(sa)->sin_addr.s_addr); case AF_INET6: - return ntohl(((struct sockaddr_in6 *)sa)->sin6_addr - .s6_addr32[3]); + return ntohl(satosin6(sa)->sin6_addr.s6_addr32[3]); } panic("pipex_sockaddr_hash_key: unknown address family"); return (0); @@ -2982,16 +2981,15 @@ pipex_sockaddr_compar_addr(struct sockaddr *a, struct sockaddr *b) return cmp; switch (a->sa_family) { case AF_INET: - return ((struct sockaddr_in *)b)->sin_addr.s_addr - - ((struct sockaddr_in *)a)->sin_addr.s_addr; + return (satosin(b)->sin_addr.s_addr - + satosin(a)->sin_addr.s_addr); case AF_INET6: - cmp = ((struct sockaddr_in6 *)b)->sin6_scope_id - - ((struct sockaddr_in6 *)a)->sin6_scope_id; + cmp = (satosin6(b)->sin6_scope_id - satosin6(a)->sin6_scope_id); if (cmp != 0) return cmp; - return memcmp(&((struct sockaddr_in6 *)a)->sin6_addr, - &((struct sockaddr_in6 *)b)->sin6_addr, - sizeof(struct in6_addr)); + return (memcmp(&satosin6(a)->sin6_addr, + &satosin6(b)->sin6_addr, + sizeof(struct in6_addr))); } panic("pipex_sockaddr_compar_addr: unknown address family"); diff --git a/sys/net/radix_mpath.c b/sys/net/radix_mpath.c index c23d1ee70d9..54b78e4c9bd 100644 --- a/sys/net/radix_mpath.c +++ b/sys/net/radix_mpath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radix_mpath.c,v 1.31 2015/07/18 15:51:16 mpi Exp $ */ +/* $OpenBSD: radix_mpath.c,v 1.32 2015/09/01 21:24:04 bluhm Exp $ */ /* $KAME: radix_mpath.c,v 1.13 2002/10/28 21:05:59 itojun Exp $ */ /* @@ -452,7 +452,7 @@ rn_mpath_hash(struct sockaddr *dst, u_int32_t *srcaddrp) { struct sockaddr_in *sin_dst; - sin_dst = (struct sockaddr_in *)dst; + sin_dst = satosin(dst); a += sin_dst->sin_addr.s_addr; b += srcaddrp ? srcaddrp[0] : 0; mix(a, b, c); @@ -463,7 +463,7 @@ rn_mpath_hash(struct sockaddr *dst, u_int32_t *srcaddrp) { struct sockaddr_in6 *sin6_dst; - sin6_dst = (struct sockaddr_in6 *)dst; + sin6_dst = satosin6(dst); a += sin6_dst->sin6_addr.s6_addr32[0]; b += sin6_dst->sin6_addr.s6_addr32[2]; c += srcaddrp ? srcaddrp[0] : 0; diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 000b0459c6c..9043a1def91 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.174 2015/08/22 20:18:50 deraadt Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.175 2015/09/01 21:24:04 bluhm Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -895,7 +895,7 @@ in_selectsrc(struct in_addr **insrc, struct sockaddr_in *sin, * It is important to zero out the rest of the * struct sockaddr_in when mixing v6 & v4! */ - sin2 = (struct sockaddr_in *)&ro->ro_dst; + sin2 = satosin(&ro->ro_dst); memset(sin2->sin_zero, 0, sizeof(sin2->sin_zero)); } /* diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 7f834db15fc..1494b5bf84e 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_divert.c,v 1.36 2015/08/14 18:07:28 bluhm Exp $ */ +/* $OpenBSD: ip_divert.c,v 1.37 2015/09/01 21:24:04 bluhm Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -225,8 +225,7 @@ divert_packet(struct mbuf *m, int dir, u_int16_t divert_port) if (inp) { sa = inp->inp_socket; - if (sbappendaddr(&sa->so_rcv, (struct sockaddr *)&addr, - m, NULL) == 0) { + if (sbappendaddr(&sa->so_rcv, sintosa(&addr), m, NULL) == 0) { divstat.divs_fullsock++; m_freem(m); return (0); diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index c8cd1f70b70..bdcc12feeb7 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_icmp.c,v 1.137 2015/08/14 18:07:28 bluhm Exp $ */ +/* $OpenBSD: ip_icmp.c,v 1.138 2015/09/01 21:24:04 bluhm Exp $ */ /* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */ /* @@ -1034,10 +1034,10 @@ icmp_mtudisc_timeout(struct rtentry *rt, struct rttimer *r) if ((rt->rt_flags & (RTF_DYNAMIC | RTF_HOST)) == (RTF_DYNAMIC | RTF_HOST)) { void *(*ctlfunc)(int, struct sockaddr *, u_int, void *); - struct sockaddr_in sa; + struct sockaddr_in sin; int s; - sa = *satosin(rt_key(rt)); + sin = *satosin(rt_key(rt)); s = splsoftnet(); rtdeletemsg(rt, r->rtt_tableid); @@ -1045,7 +1045,7 @@ icmp_mtudisc_timeout(struct rtentry *rt, struct rttimer *r) /* Notify TCP layer of increased Path MTU estimate */ ctlfunc = inetsw[ip_protox[IPPROTO_TCP]].pr_ctlinput; if (ctlfunc) - (*ctlfunc)(PRC_MTUINC,(struct sockaddr *)&sa, + (*ctlfunc)(PRC_MTUINC, sintosa(&sin), r->rtt_tableid, NULL); splx(s); } else diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index f55e79c606a..20c3fbedd8b 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_mroute.c,v 1.80 2015/08/24 14:00:29 bluhm Exp $ */ +/* $OpenBSD: ip_mroute.c,v 1.81 2015/09/01 21:24:04 bluhm Exp $ */ /* $NetBSD: ip_mroute.c,v 1.85 2004/04/26 01:31:57 matt Exp $ */ /* @@ -2201,7 +2201,7 @@ pim_input(struct mbuf *m, ...) reg_vif_num); } /* NB: vifp was collected above; can it change on us? */ - looutput(vifp, m, (struct sockaddr *)&dst, NULL); + looutput(vifp, m, sintosa(&dst), NULL); /* prepare the register head to send to the mrouting daemon */ m = mcp; diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 4a61fef5fa6..b547a77844a 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_subr.c,v 1.146 2015/08/27 20:56:16 bluhm Exp $ */ +/* $OpenBSD: tcp_subr.c,v 1.147 2015/09/01 21:24:04 bluhm Exp $ */ /* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */ /* @@ -850,8 +850,7 @@ tcp_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *v) sin.sin_family = AF_INET; sin.sin_port = th->th_sport; sin.sin_addr = ip->ip_src; - syn_cache_unreach((struct sockaddr *)&sin, - sa, th, rdomain); + syn_cache_unreach(sintosa(&sin), sa, th, rdomain); } } else in_pcbnotifyall(&tcbtable, sa, rdomain, errno, notify); diff --git a/sys/nfs/nfs_boot.c b/sys/nfs/nfs_boot.c index 81614c85062..fe50ad05c6e 100644 --- a/sys/nfs/nfs_boot.c +++ b/sys/nfs/nfs_boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_boot.c,v 1.38 2015/08/14 18:07:28 bluhm Exp $ */ +/* $OpenBSD: nfs_boot.c,v 1.39 2015/09/01 21:24:04 bluhm Exp $ */ /* $NetBSD: nfs_boot.c,v 1.26 1996/05/07 02:51:25 thorpej Exp $ */ /* @@ -242,7 +242,7 @@ nfs_boot_getfh(struct sockaddr_in *bpsin, char *key, /* Initialize mount args. */ memset(args, 0, sizeof(*args)); - args->addr = (struct sockaddr *)&ndmntp->ndm_saddr; + args->addr = sintosa(&ndmntp->ndm_saddr); args->addrlen = args->addr->sa_len; args->sotype = SOCK_DGRAM; args->fh = ndmntp->ndm_fh; |