1/*
2 * Copyright (c) 1982, 1986, 1988, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 17 unchanged lines hidden (view full) ---
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * From: @(#)tcp_usrreq.c 8.2 (Berkeley) 1/3/94
34 * $FreeBSD: head/sys/netinet/tcp_usrreq.c 55009 1999-12-22 19:13:38Z shin $
35 */
36
37#include "opt_ipsec.h"
38#include "opt_tcpdebug.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/kernel.h>
43#include <sys/sysctl.h>
44#include <sys/mbuf.h>
45#include <sys/socket.h>
--- 13 unchanged lines hidden (view full) ---
59#include <netinet/tcp_seq.h>
60#include <netinet/tcp_timer.h>
61#include <netinet/tcp_var.h>
62#include <netinet/tcpip.h>
63#ifdef TCPDEBUG
64#include <netinet/tcp_debug.h>
65#endif
66
67#ifdef IPSEC
68#include <netinet6/ipsec.h>
69#endif /*IPSEC*/
70
71/*
72 * TCP protocol interface to socket abstraction.
73 */
74extern char *tcpstates[]; /* XXX ??? */
75
76static int tcp_attach __P((struct socket *, struct proc *));
77static int tcp_connect __P((struct tcpcb *, struct sockaddr *,
78 struct proc *));
--- 652 unchanged lines hidden (view full) ---
731 error = soreserve(so, tcp_sendspace, tcp_recvspace);
732 if (error)
733 return (error);
734 }
735 error = in_pcballoc(so, &tcbinfo, p);
736 if (error)
737 return (error);
738 inp = sotoinpcb(so);
739#ifdef IPSEC
740 error = ipsec_init_policy(so, &inp->inp_sp);
741 if (error) {
742 in_pcbdetach(inp);
743 return (error);
744 }
745#endif /*IPSEC*/
746 inp->inp_vflag |= INP_IPV4;
747 tp = tcp_newtcpcb(inp);
748 if (tp == 0) {
749 int nofd = so->so_state & SS_NOFDREF; /* XXX */
750
751 so->so_state &= ~SS_NOFDREF; /* don't free the socket yet */
752 in_pcbdetach(inp);
753 so->so_state |= nofd;
--- 80 unchanged lines hidden ---
2 * Copyright (c) 1982, 1986, 1988, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 17 unchanged lines hidden (view full) ---
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * From: @(#)tcp_usrreq.c 8.2 (Berkeley) 1/3/94
34 * $FreeBSD: head/sys/netinet/tcp_usrreq.c 55009 1999-12-22 19:13:38Z shin $
35 */
36
37#include "opt_ipsec.h"
38#include "opt_tcpdebug.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/kernel.h>
43#include <sys/sysctl.h>
44#include <sys/mbuf.h>
45#include <sys/socket.h>
--- 13 unchanged lines hidden (view full) ---
59#include <netinet/tcp_seq.h>
60#include <netinet/tcp_timer.h>
61#include <netinet/tcp_var.h>
62#include <netinet/tcpip.h>
63#ifdef TCPDEBUG
64#include <netinet/tcp_debug.h>
65#endif
66
67#ifdef IPSEC
68#include <netinet6/ipsec.h>
69#endif /*IPSEC*/
70
71/*
72 * TCP protocol interface to socket abstraction.
73 */
74extern char *tcpstates[]; /* XXX ??? */
75
76static int tcp_attach __P((struct socket *, struct proc *));
77static int tcp_connect __P((struct tcpcb *, struct sockaddr *,
78 struct proc *));
--- 652 unchanged lines hidden (view full) ---
731 error = soreserve(so, tcp_sendspace, tcp_recvspace);
732 if (error)
733 return (error);
734 }
735 error = in_pcballoc(so, &tcbinfo, p);
736 if (error)
737 return (error);
738 inp = sotoinpcb(so);
739#ifdef IPSEC
740 error = ipsec_init_policy(so, &inp->inp_sp);
741 if (error) {
742 in_pcbdetach(inp);
743 return (error);
744 }
745#endif /*IPSEC*/
746 inp->inp_vflag |= INP_IPV4;
747 tp = tcp_newtcpcb(inp);
748 if (tp == 0) {
749 int nofd = so->so_state & SS_NOFDREF; /* XXX */
750
751 so->so_state &= ~SS_NOFDREF; /* don't free the socket yet */
752 in_pcbdetach(inp);
753 so->so_state |= nofd;
--- 80 unchanged lines hidden ---