Deleted Added
full compact
sctp6_usrreq.c (171440) sctp6_usrreq.c (171477)
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.

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

24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
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#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.

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

24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
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#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/netinet6/sctp6_usrreq.c 171440 2007-07-14 09:36:28Z rrs $");
32__FBSDID("$FreeBSD: head/sys/netinet6/sctp6_usrreq.c 171477 2007-07-17 20:58:26Z rrs $");
33
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)

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

609 if (IN6_IS_ADDR_UNSPECIFIED(&sin6_p->sin6_addr)) {
610 inp6->inp_vflag |= INP_IPV4;
611 } else if (IN6_IS_ADDR_V4MAPPED(&sin6_p->sin6_addr)) {
612 struct sockaddr_in sin;
613
614 in6_sin6_2_sin(&sin, sin6_p);
615 inp6->inp_vflag |= INP_IPV4;
616 inp6->inp_vflag &= ~INP_IPV6;
33
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)

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

609 if (IN6_IS_ADDR_UNSPECIFIED(&sin6_p->sin6_addr)) {
610 inp6->inp_vflag |= INP_IPV4;
611 } else if (IN6_IS_ADDR_V4MAPPED(&sin6_p->sin6_addr)) {
612 struct sockaddr_in sin;
613
614 in6_sin6_2_sin(&sin, sin6_p);
615 inp6->inp_vflag |= INP_IPV4;
616 inp6->inp_vflag &= ~INP_IPV6;
617 error = sctp_inpcb_bind(so, (struct sockaddr *)&sin, NULL, p);
617 error = sctp_inpcb_bind(so, (struct sockaddr *)&sin, p);
618 return error;
619 }
620 }
621 } else if (addr != NULL) {
622 /* IPV6_V6ONLY socket */
623 if (addr->sa_family == AF_INET) {
624 /* can't bind v4 addr to v6 only socket! */
625 return EINVAL;
626 } else {
627 struct sockaddr_in6 *sin6_p;
628
629 sin6_p = (struct sockaddr_in6 *)addr;
630
631 if (IN6_IS_ADDR_V4MAPPED(&sin6_p->sin6_addr))
632 /* can't bind v4-mapped addrs either! */
633 /* NOTE: we don't support SIIT */
634 return EINVAL;
635 }
636 }
618 return error;
619 }
620 }
621 } else if (addr != NULL) {
622 /* IPV6_V6ONLY socket */
623 if (addr->sa_family == AF_INET) {
624 /* can't bind v4 addr to v6 only socket! */
625 return EINVAL;
626 } else {
627 struct sockaddr_in6 *sin6_p;
628
629 sin6_p = (struct sockaddr_in6 *)addr;
630
631 if (IN6_IS_ADDR_V4MAPPED(&sin6_p->sin6_addr))
632 /* can't bind v4-mapped addrs either! */
633 /* NOTE: we don't support SIIT */
634 return EINVAL;
635 }
636 }
637 error = sctp_inpcb_bind(so, addr, NULL, p);
637 error = sctp_inpcb_bind(so, addr, p);
638 return error;
639}
640
641
642static void
643sctp6_close(struct socket *so)
644{
645 struct sctp_inpcb *inp;

--- 649 unchanged lines hidden ---
638 return error;
639}
640
641
642static void
643sctp6_close(struct socket *so)
644{
645 struct sctp_inpcb *inp;

--- 649 unchanged lines hidden ---