Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet6 Use sin6tosa and sin6tocsa macros
details: https://anonhg.NetBSD.org/src/rev/073d2fe31d78
branches: trunk
changeset: 346497:073d2fe31d78
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Fri Jul 15 07:40:09 2016 +0000
description:
Use sin6tosa and sin6tocsa macros
No functional change.
diffstat:
sys/netinet6/icmp6.c | 26 ++++++++++++--------------
sys/netinet6/in6.c | 40 ++++++++++++++++------------------------
sys/netinet6/in6_gif.c | 6 +++---
sys/netinet6/in6_pcb.c | 6 +++---
sys/netinet6/in6_src.c | 6 +++---
sys/netinet6/ip6_mroute.c | 11 +++++------
sys/netinet6/nd6.c | 14 +++++++-------
sys/netinet6/nd6_nbr.c | 6 +++---
sys/netinet6/nd6_rtr.c | 12 ++++++------
sys/netinet6/raw_ip6.c | 12 ++++++------
sys/netinet6/sctp6_usrreq.c | 11 +++++------
sys/netinet6/udp6_usrreq.c | 13 ++++++-------
12 files changed, 75 insertions(+), 88 deletions(-)
diffs (truncated from 590 to 300 lines):
diff -r a8e07fce4522 -r 073d2fe31d78 sys/netinet6/icmp6.c
--- a/sys/netinet6/icmp6.c Fri Jul 15 07:33:41 2016 +0000
+++ b/sys/netinet6/icmp6.c Fri Jul 15 07:40:09 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: icmp6.c,v 1.193 2016/07/15 07:33:41 ozaki-r Exp $ */
+/* $NetBSD: icmp6.c,v 1.194 2016/07/15 07:40:09 ozaki-r Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.193 2016/07/15 07:33:41 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.194 2016/07/15 07:40:09 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -1080,7 +1080,7 @@
ctlfunc = (void (*)(int, struct sockaddr *, void *))
(inet6sw[ip6_protox[nxt]].pr_ctlinput);
if (ctlfunc) {
- (void) (*ctlfunc)(code, (struct sockaddr *)&icmp6dst,
+ (void) (*ctlfunc)(code, sin6tosa(&icmp6dst),
&ip6cp);
}
}
@@ -1150,7 +1150,7 @@
}
m_put_rcvif(rcvif, &s);
- rt = icmp6_mtudisc_clone((struct sockaddr *)&sin6);
+ rt = icmp6_mtudisc_clone(sin6tosa(&sin6));
if (rt && (rt->rt_flags & RTF_HOST) &&
!(rt->rt_rmx.rmx_locks & RTV_MTU) &&
@@ -1220,7 +1220,7 @@
*/
sockaddr_in6_init(&sin6, &ip6->ip6_dst, 0, 0, 0);
/* XXX scopeid */
- if (ifa_ifwithaddr((struct sockaddr *)&sin6))
+ if (ifa_ifwithaddr(sin6tosa(&sin6)))
; /* unicast/anycast, fine */
else if (IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr))
; /* link-local multicast, fine */
@@ -1935,8 +1935,7 @@
/* strip intermediate headers */
m_adj(n, off);
if (sbappendaddr(&last->in6p_socket->so_rcv,
- (struct sockaddr *)&rip6src,
- n, opts) == 0) {
+ sin6tosa(&rip6src), n, opts) == 0) {
/* should notify about lost packet */
m_freem(n);
if (opts)
@@ -1954,7 +1953,7 @@
/* strip intermediate headers */
m_adj(m, off);
if (sbappendaddr(&last->in6p_socket->so_rcv,
- (struct sockaddr *)&rip6src, m, opts) == 0) {
+ sin6tosa(&rip6src), m, opts) == 0) {
m_freem(m);
if (opts)
m_freem(opts);
@@ -2220,7 +2219,7 @@
struct in6_addr *gw6;
sockaddr_in6_init(&sin6, &reddst6, 0, 0, 0);
- rt = rtalloc1((struct sockaddr *)&sin6, 0);
+ rt = rtalloc1(sin6tosa(&sin6), 0);
if (rt) {
if (rt->rt_gateway == NULL ||
rt->rt_gateway->sa_family != AF_INET6) {
@@ -2335,9 +2334,8 @@
bcopy(&redtgt6, &sgw.sin6_addr, sizeof(struct in6_addr));
bcopy(&reddst6, &sdst.sin6_addr, sizeof(struct in6_addr));
bcopy(&src6, &ssrc.sin6_addr, sizeof(struct in6_addr));
- rtredirect((struct sockaddr *)&sdst, (struct sockaddr *)&sgw,
- NULL, RTF_GATEWAY | RTF_HOST,
- (struct sockaddr *)&ssrc,
+ rtredirect(sin6tosa(&sdst), sin6tosa(&sgw), NULL,
+ RTF_GATEWAY | RTF_HOST, sin6tosa(&ssrc),
&newrt);
if (newrt) {
@@ -2351,10 +2349,10 @@
struct sockaddr_in6 sdst;
sockaddr_in6_init(&sdst, &reddst6, 0, 0, 0);
- pfctlinput(PRC_REDIRECT_HOST, (struct sockaddr *)&sdst);
+ pfctlinput(PRC_REDIRECT_HOST, sin6tosa(&sdst));
#if defined(IPSEC)
if (ipsec_used)
- key_sa_routechange((struct sockaddr *)&sdst);
+ key_sa_routechange(sin6tosa(&sdst));
#endif
}
diff -r a8e07fce4522 -r 073d2fe31d78 sys/netinet6/in6.c
--- a/sys/netinet6/in6.c Fri Jul 15 07:33:41 2016 +0000
+++ b/sys/netinet6/in6.c Fri Jul 15 07:40:09 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6.c,v 1.208 2016/07/08 06:18:29 ozaki-r Exp $ */
+/* $NetBSD: in6.c,v 1.209 2016/07/15 07:40:09 ozaki-r Exp $ */
/* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.208 2016/07/08 06:18:29 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.209 2016/07/15 07:40:09 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -911,7 +911,7 @@
memset(ia, 0, sizeof(*ia));
LIST_INIT(&ia->ia6_memberships);
/* Initialize the address and masks, and put time stamp */
- ia->ia_ifa.ifa_addr = (struct sockaddr *)&ia->ia_addr;
+ ia->ia_ifa.ifa_addr = sin6tosa(&ia->ia_addr);
ia->ia_addr.sin6_family = AF_INET6;
ia->ia_addr.sin6_len = sizeof(ia->ia_addr);
ia->ia6_createtime = time_uptime;
@@ -920,13 +920,11 @@
* XXX: some functions expect that ifa_dstaddr is not
* NULL for p2p interfaces.
*/
- ia->ia_ifa.ifa_dstaddr =
- (struct sockaddr *)&ia->ia_dstaddr;
+ ia->ia_ifa.ifa_dstaddr = sin6tosa(&ia->ia_dstaddr);
} else {
ia->ia_ifa.ifa_dstaddr = NULL;
}
- ia->ia_ifa.ifa_netmask =
- (struct sockaddr *)&ia->ia_prefixmask;
+ ia->ia_ifa.ifa_netmask = sin6tosa(&ia->ia_prefixmask);
ia->ia_ifp = ifp;
IN6_ADDRLIST_ENTRY_INIT(ia);
@@ -1105,7 +1103,7 @@
* actually do not need the routes, since they usually specify
* the outgoing interface.
*/
- rt = rtalloc1((struct sockaddr *)&mltaddr, 0);
+ rt = rtalloc1(sin6tosa(&mltaddr), 0);
if (rt) {
if (memcmp(&mltaddr.sin6_addr,
&satocsin6(rt_getkey(rt))->sin6_addr,
@@ -1128,13 +1126,10 @@
struct rt_addrinfo info;
memset(&info, 0, sizeof(info));
- info.rti_info[RTAX_DST] = (struct sockaddr *)&mltaddr;
- info.rti_info[RTAX_GATEWAY] =
- (struct sockaddr *)&ia->ia_addr;
- info.rti_info[RTAX_NETMASK] =
- (struct sockaddr *)&mltmask;
- info.rti_info[RTAX_IFA] =
- (struct sockaddr *)&ia->ia_addr;
+ info.rti_info[RTAX_DST] = sin6tosa(&mltaddr);
+ info.rti_info[RTAX_GATEWAY] = sin6tosa(&ia->ia_addr);
+ info.rti_info[RTAX_NETMASK] = sin6tosa(&mltmask);
+ info.rti_info[RTAX_IFA] = sin6tosa(&ia->ia_addr);
/* XXX: we need RTF_CONNECTED to fake nd6_rtrequest */
info.rti_flags = RTF_UP | RTF_CONNECTED;
error = rtrequest1(RTM_ADD, &info, NULL);
@@ -1188,7 +1183,7 @@
goto cleanup; /* XXX: should not fail */
/* XXX: again, do we really need the route? */
- rt = rtalloc1((struct sockaddr *)&mltaddr, 0);
+ rt = rtalloc1(sin6tosa(&mltaddr), 0);
if (rt) {
/* 32bit came from "mltmask" */
if (memcmp(&mltaddr.sin6_addr,
@@ -1212,13 +1207,10 @@
struct rt_addrinfo info;
memset(&info, 0, sizeof(info));
- info.rti_info[RTAX_DST] = (struct sockaddr *)&mltaddr;
- info.rti_info[RTAX_GATEWAY] =
- (struct sockaddr *)&ia->ia_addr;
- info.rti_info[RTAX_NETMASK] =
- (struct sockaddr *)&mltmask;
- info.rti_info[RTAX_IFA] =
- (struct sockaddr *)&ia->ia_addr;
+ info.rti_info[RTAX_DST] = sin6tosa(&mltaddr);
+ info.rti_info[RTAX_GATEWAY] = sin6tosa(&ia->ia_addr);
+ info.rti_info[RTAX_NETMASK] = sin6tosa(&mltmask);
+ info.rti_info[RTAX_IFA] = sin6tosa(&ia->ia_addr);
info.rti_flags = RTF_UP | RTF_CONNECTED;
error = rtrequest1(RTM_ADD, &info, NULL);
if (error)
@@ -2621,5 +2613,5 @@
sin_p = (struct sockaddr_in *)*nam;
in6_sin_2_v4mapsin6(sin_p, sin6_p);
free(*nam, M_SONAME);
- *nam = (struct sockaddr *)sin6_p;
+ *nam = sin6tosa(sin6_p);
}
diff -r a8e07fce4522 -r 073d2fe31d78 sys/netinet6/in6_gif.c
--- a/sys/netinet6/in6_gif.c Fri Jul 15 07:33:41 2016 +0000
+++ b/sys/netinet6/in6_gif.c Fri Jul 15 07:40:09 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_gif.c,v 1.78 2016/07/06 00:30:55 ozaki-r Exp $ */
+/* $NetBSD: in6_gif.c,v 1.79 2016/07/15 07:40:09 ozaki-r Exp $ */
/* $KAME: in6_gif.c,v 1.62 2001/07/29 04:27:25 itojun Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.78 2016/07/06 00:30:55 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.79 2016/07/15 07:40:09 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -381,7 +381,7 @@
if (!sc->gif_psrc || !sc->gif_pdst)
return EINVAL;
sc->encap_cookie6 = encap_attach(AF_INET6, -1, sc->gif_psrc,
- (struct sockaddr *)&mask6, sc->gif_pdst, (struct sockaddr *)&mask6,
+ sin6tosa(&mask6), sc->gif_pdst, sin6tosa(&mask6),
(const void *)&in6_gif_encapsw, sc);
#else
sc->encap_cookie6 = encap_attach_func(AF_INET6, -1, gif_encapcheck,
diff -r a8e07fce4522 -r 073d2fe31d78 sys/netinet6/in6_pcb.c
--- a/sys/netinet6/in6_pcb.c Fri Jul 15 07:33:41 2016 +0000
+++ b/sys/netinet6/in6_pcb.c Fri Jul 15 07:40:09 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_pcb.c,v 1.146 2016/07/15 07:33:41 ozaki-r Exp $ */
+/* $NetBSD: in6_pcb.c,v 1.147 2016/07/15 07:40:09 ozaki-r Exp $ */
/* $KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.146 2016/07/15 07:33:41 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.147 2016/07/15 07:40:09 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -240,7 +240,7 @@
struct ifaddr *ia = NULL;
if ((in6p->in6p_flags & IN6P_FAITH) == 0 &&
- (ia = ifa_ifwithaddr((struct sockaddr *)sin6)) == NULL)
+ (ia = ifa_ifwithaddr(sin6tosa(sin6))) == NULL)
return (EADDRNOTAVAIL);
/*
diff -r a8e07fce4522 -r 073d2fe31d78 sys/netinet6/in6_src.c
--- a/sys/netinet6/in6_src.c Fri Jul 15 07:33:41 2016 +0000
+++ b/sys/netinet6/in6_src.c Fri Jul 15 07:40:09 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_src.c,v 1.64 2016/07/15 07:33:41 ozaki-r Exp $ */
+/* $NetBSD: in6_src.c,v 1.65 2016/07/15 07:40:09 ozaki-r Exp $ */
/* $KAME: in6_src.c,v 1.159 2005/10/19 01:40:32 t-momose Exp $ */
/*
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.64 2016/07/15 07:33:41 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.65 2016/07/15 07:40:09 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -240,7 +240,7 @@
goto exit;
}
- ia6 = ifatoia6(ifa_ifwithaddr((struct sockaddr *)(&srcsock)));
+ ia6 = ifatoia6(ifa_ifwithaddr(sin6tosa(&srcsock)));
if (ia6 == NULL ||
(ia6->ia6_flags & (IN6_IFF_ANYCAST | IN6_IFF_NOTREADY))) {
*errorp = EADDRNOTAVAIL;
diff -r a8e07fce4522 -r 073d2fe31d78 sys/netinet6/ip6_mroute.c
--- a/sys/netinet6/ip6_mroute.c Fri Jul 15 07:33:41 2016 +0000
+++ b/sys/netinet6/ip6_mroute.c Fri Jul 15 07:40:09 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6_mroute.c,v 1.111 2016/06/21 03:28:27 ozaki-r Exp $ */
+/* $NetBSD: ip6_mroute.c,v 1.112 2016/07/15 07:40:09 ozaki-r Exp $ */
/* $KAME: ip6_mroute.c,v 1.49 2001/07/25 09:21:18 jinmei Exp $ */
/*
@@ -117,7 +117,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.111 2016/06/21 03:28:27 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.112 2016/07/15 07:40:09 ozaki-r Exp $");
#ifdef _KERNEL_OPT
Home |
Main Index |
Thread Index |
Old Index