svn commit: r252971 - in stable/9/sys: netinet netinet6
Michael Tuexen
tuexen at FreeBSD.org
Sun Jul 7 16:51:18 UTC 2013
Author: tuexen
Date: Sun Jul 7 16:51:17 2013
New Revision: 252971
URL: http://svnweb.freebsd.org/changeset/base/252971
Log:
MFC r250466:
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.
Modified:
stable/9/sys/netinet/sctp_pcb.c
stable/9/sys/netinet6/sctp6_usrreq.c
Directory Properties:
stable/9/sys/ (props changed)
Modified: stable/9/sys/netinet/sctp_pcb.c
==============================================================================
--- stable/9/sys/netinet/sctp_pcb.c Sun Jul 7 16:31:07 2013 (r252970)
+++ stable/9/sys/netinet/sctp_pcb.c Sun Jul 7 16:51:17 2013 (r252971)
@@ -2376,8 +2376,13 @@ sctp_inpcb_alloc(struct socket *so, uint
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;
Modified: stable/9/sys/netinet6/sctp6_usrreq.c
==============================================================================
--- stable/9/sys/netinet6/sctp6_usrreq.c Sun Jul 7 16:31:07 2013 (r252970)
+++ stable/9/sys/netinet6/sctp6_usrreq.c Sun Jul 7 16:51:17 2013 (r252971)
@@ -787,18 +787,11 @@ sctp6_send(struct socket *so, int flags,
}
}
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
}
}
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? */
More information about the svn-src-stable-9
mailing list