mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Honor the net.inet6.ip6.v6only sysctl variable and the IPV6_V6ONLY
socket option for SCTP sockets in the same way as for UDP or TCP sockets. MFC after: 2 weeks
This commit is contained in:
parent
1bfbcedae9
commit
3457ccdaea
2 changed files with 14 additions and 24 deletions
|
|
@ -2376,8 +2376,13 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id)
|
|||
inp->sctp_socket = so;
|
||||
inp->ip_inp.inp.inp_socket = so;
|
||||
#ifdef INET6
|
||||
if (MODULE_GLOBAL(ip6_auto_flowlabel)) {
|
||||
inp->ip_inp.inp.inp_flags |= IN6P_AUTOFLOWLABEL;
|
||||
if (INP_SOCKAF(so) == AF_INET6) {
|
||||
if (MODULE_GLOBAL(ip6_auto_flowlabel)) {
|
||||
inp->ip_inp.inp.inp_flags |= IN6P_AUTOFLOWLABEL;
|
||||
}
|
||||
if (MODULE_GLOBAL(ip6_v6only)) {
|
||||
inp->ip_inp.inp.inp_flags |= IN6P_IPV6_V6ONLY;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
inp->sctp_associd_counter = 1;
|
||||
|
|
|
|||
|
|
@ -787,18 +787,11 @@ sctp6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr,
|
|||
}
|
||||
}
|
||||
if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
|
||||
if (!MODULE_GLOBAL(ip6_v6only)) {
|
||||
struct sockaddr_in sin;
|
||||
struct sockaddr_in sin;
|
||||
|
||||
/* convert v4-mapped into v4 addr and send */
|
||||
in6_sin6_2_sin(&sin, sin6);
|
||||
return (sctp_sendm(so, flags, m, (struct sockaddr *)&sin,
|
||||
control, p));
|
||||
} else {
|
||||
/* mapped addresses aren't enabled */
|
||||
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL);
|
||||
return (EINVAL);
|
||||
}
|
||||
/* convert v4-mapped into v4 addr and send */
|
||||
in6_sin6_2_sin(&sin, sin6);
|
||||
return (sctp_sendm(so, flags, m, (struct sockaddr *)&sin, control, p));
|
||||
}
|
||||
#endif /* INET */
|
||||
connected_type:
|
||||
|
|
@ -932,17 +925,9 @@ sctp6_connect(struct socket *so, struct sockaddr *addr, struct thread *p)
|
|||
}
|
||||
}
|
||||
if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
|
||||
if (!MODULE_GLOBAL(ip6_v6only)) {
|
||||
/* convert v4-mapped into v4 addr */
|
||||
in6_sin6_2_sin((struct sockaddr_in *)&ss, sin6);
|
||||
addr = (struct sockaddr *)&ss;
|
||||
} else {
|
||||
/* mapped addresses aren't enabled */
|
||||
SCTP_INP_RUNLOCK(inp);
|
||||
SCTP_ASOC_CREATE_UNLOCK(inp);
|
||||
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL);
|
||||
return (EINVAL);
|
||||
}
|
||||
/* convert v4-mapped into v4 addr */
|
||||
in6_sin6_2_sin((struct sockaddr_in *)&ss, sin6);
|
||||
addr = (struct sockaddr *)&ss;
|
||||
}
|
||||
#endif /* INET */
|
||||
/* Now do we connect? */
|
||||
|
|
|
|||
Loading…
Reference in a new issue