Deleted Added
full compact
tcp_syncache.c (221250) tcp_syncache.c (222488)
1/*-
2 * Copyright (c) 2001 McAfee, Inc.
3 * Copyright (c) 2006 Andre Oppermann, Internet Business Solutions AG
4 * All rights reserved.
5 *
6 * This software was developed for the FreeBSD Project by Jonathan Lemon
7 * and McAfee Research, the Security Research Division of McAfee, Inc. under
8 * DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the

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

26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001 McAfee, Inc.
3 * Copyright (c) 2006 Andre Oppermann, Internet Business Solutions AG
4 * All rights reserved.
5 *
6 * This software was developed for the FreeBSD Project by Jonathan Lemon
7 * and McAfee Research, the Security Research Division of McAfee, Inc. under
8 * DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the

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

26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/netinet/tcp_syncache.c 221250 2011-04-30 11:21:29Z bz $");
34__FBSDID("$FreeBSD: head/sys/netinet/tcp_syncache.c 222488 2011-05-30 09:43:55Z rwatson $");
35
36#include "opt_inet.h"
37#include "opt_inet6.h"
38#include "opt_ipsec.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/kernel.h>

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

656 }
657#ifdef MAC
658 mac_socketpeer_set_from_mbuf(m, so);
659#endif
660
661 inp = sotoinpcb(so);
662 inp->inp_inc.inc_fibnum = so->so_fibnum;
663 INP_WLOCK(inp);
35
36#include "opt_inet.h"
37#include "opt_inet6.h"
38#include "opt_ipsec.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/kernel.h>

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

656 }
657#ifdef MAC
658 mac_socketpeer_set_from_mbuf(m, so);
659#endif
660
661 inp = sotoinpcb(so);
662 inp->inp_inc.inc_fibnum = so->so_fibnum;
663 INP_WLOCK(inp);
664 INP_HASH_WLOCK(&V_tcbinfo);
664
665 /* Insert new socket into PCB hash list. */
666 inp->inp_inc.inc_flags = sc->sc_inc.inc_flags;
667#ifdef INET6
668 if (sc->sc_inc.inc_flags & INC_ISIPV6) {
669 inp->in6p_laddr = sc->sc_inc.inc6_laddr;
670 } else {
671 inp->inp_vflag &= ~INP_IPV6;

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

689 inp->inp_laddr.s_addr = INADDR_ANY;
690 inp->inp_lport = 0;
691 if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
692 log(LOG_DEBUG, "%s; %s: in_pcbinshash failed "
693 "with error %i\n",
694 s, __func__, error);
695 free(s, M_TCPLOG);
696 }
665
666 /* Insert new socket into PCB hash list. */
667 inp->inp_inc.inc_flags = sc->sc_inc.inc_flags;
668#ifdef INET6
669 if (sc->sc_inc.inc_flags & INC_ISIPV6) {
670 inp->in6p_laddr = sc->sc_inc.inc6_laddr;
671 } else {
672 inp->inp_vflag &= ~INP_IPV6;

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

690 inp->inp_laddr.s_addr = INADDR_ANY;
691 inp->inp_lport = 0;
692 if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
693 log(LOG_DEBUG, "%s; %s: in_pcbinshash failed "
694 "with error %i\n",
695 s, __func__, error);
696 free(s, M_TCPLOG);
697 }
698 INP_HASH_WUNLOCK(&V_tcbinfo);
697 goto abort;
698 }
699#ifdef IPSEC
700 /* Copy old policy into new socket's. */
701 if (ipsec_copy_policy(sotoinpcb(lso)->inp_sp, inp->inp_sp))
702 printf("syncache_socket: could not copy policy\n");
703#endif
704#ifdef INET6

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

732 thread0.td_ucred)) != 0) {
733 inp->in6p_laddr = laddr6;
734 if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
735 log(LOG_DEBUG, "%s; %s: in6_pcbconnect failed "
736 "with error %i\n",
737 s, __func__, error);
738 free(s, M_TCPLOG);
739 }
699 goto abort;
700 }
701#ifdef IPSEC
702 /* Copy old policy into new socket's. */
703 if (ipsec_copy_policy(sotoinpcb(lso)->inp_sp, inp->inp_sp))
704 printf("syncache_socket: could not copy policy\n");
705#endif
706#ifdef INET6

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

734 thread0.td_ucred)) != 0) {
735 inp->in6p_laddr = laddr6;
736 if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
737 log(LOG_DEBUG, "%s; %s: in6_pcbconnect failed "
738 "with error %i\n",
739 s, __func__, error);
740 free(s, M_TCPLOG);
741 }
742 INP_HASH_WUNLOCK(&V_tcbinfo);
740 goto abort;
741 }
742 /* Override flowlabel from in6_pcbconnect. */
743 inp->inp_flow &= ~IPV6_FLOWLABEL_MASK;
744 inp->inp_flow |= sc->sc_flowlabel;
745 }
746#endif /* INET6 */
747#if defined(INET) && defined(INET6)

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

771 thread0.td_ucred)) != 0) {
772 inp->inp_laddr = laddr;
773 if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
774 log(LOG_DEBUG, "%s; %s: in_pcbconnect failed "
775 "with error %i\n",
776 s, __func__, error);
777 free(s, M_TCPLOG);
778 }
743 goto abort;
744 }
745 /* Override flowlabel from in6_pcbconnect. */
746 inp->inp_flow &= ~IPV6_FLOWLABEL_MASK;
747 inp->inp_flow |= sc->sc_flowlabel;
748 }
749#endif /* INET6 */
750#if defined(INET) && defined(INET6)

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

774 thread0.td_ucred)) != 0) {
775 inp->inp_laddr = laddr;
776 if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
777 log(LOG_DEBUG, "%s; %s: in_pcbconnect failed "
778 "with error %i\n",
779 s, __func__, error);
780 free(s, M_TCPLOG);
781 }
782 INP_HASH_WUNLOCK(&V_tcbinfo);
779 goto abort;
780 }
781 }
782#endif /* INET */
783 goto abort;
784 }
785 }
786#endif /* INET */
787 INP_HASH_WUNLOCK(&V_tcbinfo);
783 tp = intotcpcb(inp);
784 tp->t_state = TCPS_SYN_RECEIVED;
785 tp->iss = sc->sc_iss;
786 tp->irs = sc->sc_irs;
787 tcp_rcvseqinit(tp);
788 tcp_sendseqinit(tp);
789 tp->snd_wl1 = sc->sc_irs;
790 tp->snd_max = tp->iss + 1;

--- 1040 unchanged lines hidden ---
788 tp = intotcpcb(inp);
789 tp->t_state = TCPS_SYN_RECEIVED;
790 tp->iss = sc->sc_iss;
791 tp->irs = sc->sc_irs;
792 tcp_rcvseqinit(tp);
793 tcp_sendseqinit(tp);
794 tp->snd_wl1 = sc->sc_irs;
795 tp->snd_max = tp->iss + 1;

--- 1040 unchanged lines hidden ---