From eccb7001eea93b6f78ce07e190eb8f162a7f352d Mon Sep 17 00:00:00 2001 From: Hajimu UMEMOTO Date: Thu, 25 Jul 2002 17:40:45 +0000 Subject: [PATCH] cleanup usage of ip6_mapped_addr_on and ip6_v6only. now, ip6_mapped_addr_on is unified into ip6_v6only. MFC after: 1 week --- sys/netinet/in_pcb.c | 2 +- sys/netinet/tcp_usrreq.c | 8 +++----- sys/netinet6/ip6_var.h | 1 - sys/netinet6/udp6_usrreq.c | 6 +++--- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 744cfc263561..8284031a200e 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -159,7 +159,7 @@ in_pcballoc(so, pcbinfo, td) } #endif /*IPSEC*/ #if defined(INET6) - if (INP_SOCKAF(so) == AF_INET6 && !ip6_mapped_addr_on) + if (INP_SOCKAF(so) == AF_INET6 && ip6_v6only) inp->inp_flags |= IN6P_IPV6_V6ONLY; #endif LIST_INSERT_HEAD(pcbinfo->listhead, inp, inp_list); diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 9c4b547767cf..286fd7f2781c 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -280,7 +280,7 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, struct thread *td) } inp->inp_vflag &= ~INP_IPV4; inp->inp_vflag |= INP_IPV6; - if (ip6_mapped_addr_on && (inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) { + if (!ip6_v6only && (inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) { if (IN6_IS_ADDR_UNSPECIFIED(&sin6p->sin6_addr)) inp->inp_vflag |= INP_IPV4; else if (IN6_IS_ADDR_V4MAPPED(&sin6p->sin6_addr)) { @@ -333,8 +333,7 @@ tcp6_usr_listen(struct socket *so, struct thread *td) COMMON_START(); if (inp->inp_lport == 0) { inp->inp_vflag &= ~INP_IPV4; - if (ip6_mapped_addr_on && - (inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) + if (!ip6_v6only && (inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) inp->inp_vflag |= INP_IPV4; error = in6_pcbbind(inp, (struct sockaddr *)0, td); } @@ -408,8 +407,7 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td) if (IN6_IS_ADDR_V4MAPPED(&sin6p->sin6_addr)) { struct sockaddr_in sin; - if (!ip6_mapped_addr_on || - (inp->inp_flags & IN6P_IPV6_V6ONLY)) + if (ip6_v6only || (inp->inp_flags & IN6P_IPV6_V6ONLY)) return(EINVAL); in6_sin6_2_sin(&sin, sin6p); diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h index f226cc637a8f..fdf709bb0d7f 100644 --- a/sys/netinet6/ip6_var.h +++ b/sys/netinet6/ip6_var.h @@ -260,7 +260,6 @@ extern int ip6_gif_hlim; /* Hop limit for gif encap packet */ extern int ip6_use_deprecated; /* allow deprecated addr as source */ extern int ip6_rr_prune; /* router renumbering prefix * walk list every 5 sec. */ -#define ip6_mapped_addr_on (!ip6_v6only) extern int ip6_v6only; extern struct socket *ip6_mrouter; /* multicast routing daemon */ diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 8617d0d39c53..c9fcbcb32a69 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -538,7 +538,7 @@ udp6_attach(struct socket *so, int proto, struct thread *td) return error; inp = (struct inpcb *)so->so_pcb; inp->inp_vflag |= INP_IPV6; - if (ip6_mapped_addr_on) + if (!ip6_v6only) inp->inp_vflag |= INP_IPV4; inp->in6p_hops = -1; /* use kernel default */ inp->in6p_cksum = -1; /* just to be sure */ @@ -627,7 +627,7 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) error = in6_pcbconnect(inp, nam, td); splx(s); if (error == 0) { - if (ip6_mapped_addr_on) { /* should be non mapped addr */ + if (!ip6_v6only) { /* should be non mapped addr */ inp->inp_vflag &= ~INP_IPV4; inp->inp_vflag |= INP_IPV6; } @@ -703,7 +703,7 @@ udp6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, } } - if (ip6_mapped_addr_on) { + if (!ip6_v6only) { int hasv4addr; struct sockaddr_in6 *sin6 = 0;