diff options
author | denis <denis@cvs.openbsd.org> | 2020-11-05 10:46:14 +0000 |
---|---|---|
committer | denis <denis@cvs.openbsd.org> | 2020-11-05 10:46:14 +0000 |
commit | 3cbda2a80a4504c6a3be27183616c70bcfdb0ca7 (patch) | |
tree | bfd068eea604a40230b4bc1f3c73679f42f90357 /sys | |
parent | c010c3cf86314a5119febb31ee00af821d01499d (diff) |
Replace wrong cast with satosin.
Advised by bluhm@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/rtable.c | 8 | ||||
-rw-r--r-- | sys/netinet/in_pcb.c | 5 | ||||
-rw-r--r-- | sys/netinet6/in6_src.c | 5 |
3 files changed, 7 insertions, 11 deletions
diff --git a/sys/net/rtable.c b/sys/net/rtable.c index c176d17cf79..dd8f33af576 100644 --- a/sys/net/rtable.c +++ b/sys/net/rtable.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtable.c,v 1.70 2020/10/29 21:15:27 denis Exp $ */ +/* $OpenBSD: rtable.c,v 1.71 2020/11/05 10:46:13 denis Exp $ */ /* * Copyright (c) 2014-2016 Martin Pieuchot @@ -388,13 +388,11 @@ rtable_setsource(unsigned int rtableid, struct sockaddr *src) */ switch(src->sa_family) { case AF_INET: - if(((struct sockaddr_in *) - src->sa_data)->sin_addr.s_addr != INADDR_ANY) + if(satosin(src)->sin_addr.s_addr == INADDR_ANY) return (EINVAL); break; case AF_INET6: - if (!IN6_IS_ADDR_UNSPECIFIED(&((struct sockaddr_in6 *) - src->sa_data)->sin6_addr)) + if (IN6_IS_ADDR_UNSPECIFIED(&satosin6(src)->sin6_addr)) return (EINVAL); break; default: diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 52d4b8c9e40..213eab813f6 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.250 2020/10/29 21:15:27 denis Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.251 2020/11/05 10:46:13 denis Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -971,8 +971,7 @@ in_pcbselsrc(struct in_addr **insrc, struct sockaddr_in *sin, struct ifaddr *ifa; if ((ifa = ifa_ifwithaddr(ip4_source, rtableid)) != NULL && ISSET(ifa->ifa_ifp->if_flags, IFF_UP)) { - *insrc = &((struct sockaddr_in *) - ip4_source)->sin_addr; + *insrc = &satosin(ip4_source)->sin_addr; return (0); } } diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index 7bdfdb9d33e..eefb69cf92d 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_src.c,v 1.82 2020/10/29 21:15:27 denis Exp $ */ +/* $OpenBSD: in6_src.c,v 1.83 2020/11/05 10:46:13 denis Exp $ */ /* $KAME: in6_src.c,v 1.36 2001/02/06 04:08:17 itojun Exp $ */ /* @@ -231,8 +231,7 @@ in6_pcbselsrc(struct in6_addr **in6src, struct sockaddr_in6 *dstsock, struct ifaddr *ifa; if ((ifa = ifa_ifwithaddr(ip6_source, rtableid)) != NULL && ISSET(ifa->ifa_ifp->if_flags, IFF_UP)) { - *in6src = &((struct sockaddr_in6 *) - ip6_source)->sin6_addr; + *in6src = &satosin6(ip6_source)->sin6_addr; return (0); } } |