Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/raw_ip6.c
Show First 20 Lines • Show All 472 Lines • ▼ Show 20 Lines | hash_val = fib6_calc_software_hash(&inp->in6p_laddr, | ||||
&hash_type); | &hash_type); | ||||
inp->inp_flowid = hash_val; | inp->inp_flowid = hash_val; | ||||
inp->inp_flowtype = hash_type; | inp->inp_flowtype = hash_type; | ||||
} | } | ||||
#endif | #endif | ||||
/* | /* | ||||
* Source address selection. | * Source address selection. | ||||
*/ | */ | ||||
NET_EPOCH_ENTER(et); | |||||
error = in6_selectsrc_socket(dstsock, optp, inp, so->so_cred, | error = in6_selectsrc_socket(dstsock, optp, inp, so->so_cred, | ||||
scope_ambiguous, &in6a, &hlim); | scope_ambiguous, &in6a, &hlim); | ||||
NET_EPOCH_EXIT(et); | |||||
if (error) | if (error) | ||||
goto bad; | goto bad; | ||||
error = prison_check_ip6(inp->inp_cred, &in6a); | error = prison_check_ip6(inp->inp_cred, &in6a); | ||||
if (error != 0) | if (error != 0) | ||||
goto bad; | goto bad; | ||||
ip6->ip6_src = in6a; | ip6->ip6_src = in6a; | ||||
▲ Show 20 Lines • Show All 299 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
static int | static int | ||||
rip6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) | rip6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) | ||||
{ | { | ||||
struct inpcb *inp; | struct inpcb *inp; | ||||
struct sockaddr_in6 *addr = (struct sockaddr_in6 *)nam; | struct sockaddr_in6 *addr = (struct sockaddr_in6 *)nam; | ||||
struct in6_addr in6a; | struct in6_addr in6a; | ||||
struct epoch_tracker et; | |||||
int error = 0, scope_ambiguous = 0; | int error = 0, scope_ambiguous = 0; | ||||
inp = sotoinpcb(so); | inp = sotoinpcb(so); | ||||
KASSERT(inp != NULL, ("rip6_connect: inp == NULL")); | KASSERT(inp != NULL, ("rip6_connect: inp == NULL")); | ||||
if (nam->sa_len != sizeof(*addr)) | if (nam->sa_len != sizeof(*addr)) | ||||
return (EINVAL); | return (EINVAL); | ||||
if (CK_STAILQ_EMPTY(&V_ifnet)) | if (CK_STAILQ_EMPTY(&V_ifnet)) | ||||
Show All 12 Lines | rip6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) | ||||
if (addr->sin6_scope_id == 0 && !V_ip6_use_defzone) | if (addr->sin6_scope_id == 0 && !V_ip6_use_defzone) | ||||
scope_ambiguous = 1; | scope_ambiguous = 1; | ||||
if ((error = sa6_embedscope(addr, V_ip6_use_defzone)) != 0) | if ((error = sa6_embedscope(addr, V_ip6_use_defzone)) != 0) | ||||
return (error); | return (error); | ||||
INP_INFO_WLOCK(&V_ripcbinfo); | INP_INFO_WLOCK(&V_ripcbinfo); | ||||
INP_WLOCK(inp); | INP_WLOCK(inp); | ||||
/* Source address selection. XXX: need pcblookup? */ | /* Source address selection. XXX: need pcblookup? */ | ||||
NET_EPOCH_ENTER(et); | |||||
error = in6_selectsrc_socket(addr, inp->in6p_outputopts, | error = in6_selectsrc_socket(addr, inp->in6p_outputopts, | ||||
inp, so->so_cred, scope_ambiguous, &in6a, NULL); | inp, so->so_cred, scope_ambiguous, &in6a, NULL); | ||||
NET_EPOCH_EXIT(et); | |||||
if (error) { | if (error) { | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
INP_INFO_WUNLOCK(&V_ripcbinfo); | INP_INFO_WUNLOCK(&V_ripcbinfo); | ||||
return (error); | return (error); | ||||
} | } | ||||
inp->in6p_faddr = addr->sin6_addr; | inp->in6p_faddr = addr->sin6_addr; | ||||
inp->in6p_laddr = in6a; | inp->in6p_laddr = in6a; | ||||
▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines |