Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/udp6_usrreq.c
Show First 20 Lines • Show All 1,085 Lines • ▼ Show 20 Lines | udp6_bind(struct socket *so, struct sockaddr *nam, struct thread *td) | ||||
struct inpcbinfo *pcbinfo; | struct inpcbinfo *pcbinfo; | ||||
int error; | int error; | ||||
u_char vflagsav; | u_char vflagsav; | ||||
pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); | pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); | ||||
inp = sotoinpcb(so); | inp = sotoinpcb(so); | ||||
KASSERT(inp != NULL, ("udp6_bind: inp == NULL")); | KASSERT(inp != NULL, ("udp6_bind: inp == NULL")); | ||||
if (nam->sa_family != AF_INET6) | |||||
return (EAFNOSUPPORT); | |||||
if (nam->sa_len != sizeof(struct sockaddr_in6)) | |||||
return (EINVAL); | |||||
INP_WLOCK(inp); | INP_WLOCK(inp); | ||||
INP_HASH_WLOCK(pcbinfo); | INP_HASH_WLOCK(pcbinfo); | ||||
vflagsav = inp->inp_vflag; | vflagsav = inp->inp_vflag; | ||||
inp->inp_vflag &= ~INP_IPV4; | inp->inp_vflag &= ~INP_IPV4; | ||||
inp->inp_vflag |= INP_IPV6; | inp->inp_vflag |= INP_IPV6; | ||||
if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) { | if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) { | ||||
struct sockaddr_in6 *sin6_p; | struct sockaddr_in6 *sin6_p; | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | #endif | ||||
struct inpcb *inp; | struct inpcb *inp; | ||||
struct inpcbinfo *pcbinfo; | struct inpcbinfo *pcbinfo; | ||||
struct sockaddr_in6 *sin6; | struct sockaddr_in6 *sin6; | ||||
int error; | int error; | ||||
u_char vflagsav; | u_char vflagsav; | ||||
pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); | pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); | ||||
inp = sotoinpcb(so); | inp = sotoinpcb(so); | ||||
sin6 = (struct sockaddr_in6 *)nam; | |||||
KASSERT(inp != NULL, ("udp6_connect: inp == NULL")); | KASSERT(inp != NULL, ("udp6_connect: inp == NULL")); | ||||
sin6 = (struct sockaddr_in6 *)nam; | |||||
if (sin6->sin6_family != AF_INET6) | |||||
return (EAFNOSUPPORT); | |||||
if (sin6->sin6_len != sizeof(*sin6)) | |||||
return (EINVAL); | |||||
/* | /* | ||||
* XXXRW: Need to clarify locking of v4/v6 flags. | * XXXRW: Need to clarify locking of v4/v6 flags. | ||||
*/ | */ | ||||
INP_WLOCK(inp); | INP_WLOCK(inp); | ||||
#ifdef INET | #ifdef INET | ||||
if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { | if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { | ||||
struct sockaddr_in sin; | struct sockaddr_in sin; | ||||
▲ Show 20 Lines • Show All 177 Lines • Show Last 20 Lines |