Deleted Added
full compact
sctp6_usrreq.c (179783) sctp6_usrreq.c (180387)
1/*-
2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * a) Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.

--- 16 unchanged lines hidden (view full) ---

25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE.
29 */
30/* $KAME: sctp6_usrreq.c,v 1.38 2005/08/24 08:08:56 suz Exp $ */
31
32#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * a) Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.

--- 16 unchanged lines hidden (view full) ---

25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE.
29 */
30/* $KAME: sctp6_usrreq.c,v 1.38 2005/08/24 08:08:56 suz Exp $ */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/netinet6/sctp6_usrreq.c 179783 2008-06-14 07:58:05Z rrs $");
33__FBSDID("$FreeBSD: head/sys/netinet6/sctp6_usrreq.c 180387 2008-07-09 16:45:30Z rrs $");
34
35#include <netinet/sctp_os.h>
36#include <sys/proc.h>
37#include <netinet/sctp_pcb.h>
38#include <netinet/sctp_header.h>
39#include <netinet/sctp_var.h>
40#if defined(INET6)
41#include <netinet6/sctp6_var.h>

--- 163 unchanged lines hidden (view full) ---

205 }
206 in6p_ip = (struct inpcb *)in6p;
207#ifdef IPSEC
208 /*
209 * Check AH/ESP integrity.
210 */
211 if (in6p_ip && (ipsec6_in_reject(m, in6p_ip))) {
212/* XXX */
34
35#include <netinet/sctp_os.h>
36#include <sys/proc.h>
37#include <netinet/sctp_pcb.h>
38#include <netinet/sctp_header.h>
39#include <netinet/sctp_var.h>
40#if defined(INET6)
41#include <netinet6/sctp6_var.h>

--- 163 unchanged lines hidden (view full) ---

205 }
206 in6p_ip = (struct inpcb *)in6p;
207#ifdef IPSEC
208 /*
209 * Check AH/ESP integrity.
210 */
211 if (in6p_ip && (ipsec6_in_reject(m, in6p_ip))) {
212/* XXX */
213 ipsec6stat.in_polvio++;
213 MODULE_GLOBAL(MOD_IPSEC, ipsec6stat).in_polvio++;
214 goto bad;
215 }
216#endif /* IPSEC */
217
218 /*
219 * CONTROL chunk processing
220 */
221 offset -= sizeof(*ch);

--- 452 unchanged lines hidden (view full) ---

674 inp6->in6p_hops = -1; /* use kernel default */
675 inp6->in6p_cksum = -1; /* just to be sure */
676#ifdef INET
677 /*
678 * XXX: ugly!! IPv4 TTL initialization is necessary for an IPv6
679 * socket as well, because the socket may be bound to an IPv6
680 * wildcard address, which may match an IPv4-mapped IPv6 address.
681 */
214 goto bad;
215 }
216#endif /* IPSEC */
217
218 /*
219 * CONTROL chunk processing
220 */
221 offset -= sizeof(*ch);

--- 452 unchanged lines hidden (view full) ---

674 inp6->in6p_hops = -1; /* use kernel default */
675 inp6->in6p_cksum = -1; /* just to be sure */
676#ifdef INET
677 /*
678 * XXX: ugly!! IPv4 TTL initialization is necessary for an IPv6
679 * socket as well, because the socket may be bound to an IPv6
680 * wildcard address, which may match an IPv4-mapped IPv6 address.
681 */
682 inp6->inp_ip_ttl = ip_defttl;
682 inp6->inp_ip_ttl = MODULE_GLOBAL(MOD_INET, ip_defttl);
683#endif
684 /*
685 * Hmm what about the IPSEC stuff that is missing here but in
686 * sctp_attach()?
687 */
688 SCTP_INP_WUNLOCK(inp);
689 return 0;
690}

--- 147 unchanged lines hidden (view full) ---

838 return EINVAL;
839 }
840 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
841 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL);
842 return EINVAL;
843 }
844 }
845 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
683#endif
684 /*
685 * Hmm what about the IPSEC stuff that is missing here but in
686 * sctp_attach()?
687 */
688 SCTP_INP_WUNLOCK(inp);
689 return 0;
690}

--- 147 unchanged lines hidden (view full) ---

838 return EINVAL;
839 }
840 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
841 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL);
842 return EINVAL;
843 }
844 }
845 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
846 if (!ip6_v6only) {
846 if (!MODULE_GLOBAL(MOD_INET6, ip6_v6only)) {
847 struct sockaddr_in sin;
848
849 /* convert v4-mapped into v4 addr and send */
850 in6_sin6_2_sin(&sin, sin6);
851 return sctp_sendm(so, flags, m, (struct sockaddr *)&sin,
852 control, p);
853 } else {
854 /* mapped addresses aren't enabled */

--- 114 unchanged lines hidden (view full) ---

969 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
970 SCTP_INP_RUNLOCK(inp);
971 SCTP_ASOC_CREATE_UNLOCK(inp);
972 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL);
973 return EINVAL;
974 }
975 }
976 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
847 struct sockaddr_in sin;
848
849 /* convert v4-mapped into v4 addr and send */
850 in6_sin6_2_sin(&sin, sin6);
851 return sctp_sendm(so, flags, m, (struct sockaddr *)&sin,
852 control, p);
853 } else {
854 /* mapped addresses aren't enabled */

--- 114 unchanged lines hidden (view full) ---

969 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
970 SCTP_INP_RUNLOCK(inp);
971 SCTP_ASOC_CREATE_UNLOCK(inp);
972 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL);
973 return EINVAL;
974 }
975 }
976 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
977 if (!ip6_v6only) {
977 if (!MODULE_GLOBAL(MOD_INET6, ip6_v6only)) {
978 /* convert v4-mapped into v4 addr */
979 in6_sin6_2_sin((struct sockaddr_in *)&ss, sin6);
980 addr = (struct sockaddr *)&ss;
981 } else {
982 /* mapped addresses aren't enabled */
983 SCTP_INP_RUNLOCK(inp);
984 SCTP_ASOC_CREATE_UNLOCK(inp);
985 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL);

--- 301 unchanged lines hidden ---
978 /* convert v4-mapped into v4 addr */
979 in6_sin6_2_sin((struct sockaddr_in *)&ss, sin6);
980 addr = (struct sockaddr *)&ss;
981 } else {
982 /* mapped addresses aren't enabled */
983 SCTP_INP_RUNLOCK(inp);
984 SCTP_ASOC_CREATE_UNLOCK(inp);
985 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL);

--- 301 unchanged lines hidden ---