tcp_syncache.c (287481) | tcp_syncache.c (292309) |
---|---|
1/*- 2 * Copyright (c) 2001 McAfee, Inc. 3 * Copyright (c) 2006,2013 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,2013 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 287481 2015-09-05 10:15:19Z glebius $"); | 34__FBSDID("$FreeBSD: head/sys/netinet/tcp_syncache.c 292309 2015-12-16 00:56:45Z rrs $"); |
35 36#include "opt_inet.h" 37#include "opt_inet6.h" 38#include "opt_ipsec.h" 39#include "opt_pcbgroup.h" 40 41#include <sys/param.h> 42#include <sys/systm.h> 43#include <sys/hash.h> | 35 36#include "opt_inet.h" 37#include "opt_inet6.h" 38#include "opt_ipsec.h" 39#include "opt_pcbgroup.h" 40 41#include <sys/param.h> 42#include <sys/systm.h> 43#include <sys/hash.h> |
44#include <sys/refcount.h> |
|
44#include <sys/kernel.h> 45#include <sys/sysctl.h> 46#include <sys/limits.h> 47#include <sys/lock.h> 48#include <sys/mutex.h> 49#include <sys/malloc.h> 50#include <sys/mbuf.h> 51#include <sys/proc.h> /* for proc0 declaration */ --- 569 unchanged lines hidden (view full) --- 621/* 622 * Build a new TCP socket structure from a syncache entry. 623 * 624 * On success return the newly created socket with its underlying inp locked. 625 */ 626static struct socket * 627syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m) 628{ | 45#include <sys/kernel.h> 46#include <sys/sysctl.h> 47#include <sys/limits.h> 48#include <sys/lock.h> 49#include <sys/mutex.h> 50#include <sys/malloc.h> 51#include <sys/mbuf.h> 52#include <sys/proc.h> /* for proc0 declaration */ --- 569 unchanged lines hidden (view full) --- 622/* 623 * Build a new TCP socket structure from a syncache entry. 624 * 625 * On success return the newly created socket with its underlying inp locked. 626 */ 627static struct socket * 628syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m) 629{ |
630 struct tcp_function_block *blk; |
|
629 struct inpcb *inp = NULL; 630 struct socket *so; 631 struct tcpcb *tp; 632 int error; 633 char *s; 634 635 INP_INFO_RLOCK_ASSERT(&V_tcbinfo); 636 --- 175 unchanged lines hidden (view full) --- 812#endif /* INET */ 813 INP_HASH_WUNLOCK(&V_tcbinfo); 814 tp = intotcpcb(inp); 815 tcp_state_change(tp, TCPS_SYN_RECEIVED); 816 tp->iss = sc->sc_iss; 817 tp->irs = sc->sc_irs; 818 tcp_rcvseqinit(tp); 819 tcp_sendseqinit(tp); | 631 struct inpcb *inp = NULL; 632 struct socket *so; 633 struct tcpcb *tp; 634 int error; 635 char *s; 636 637 INP_INFO_RLOCK_ASSERT(&V_tcbinfo); 638 --- 175 unchanged lines hidden (view full) --- 814#endif /* INET */ 815 INP_HASH_WUNLOCK(&V_tcbinfo); 816 tp = intotcpcb(inp); 817 tcp_state_change(tp, TCPS_SYN_RECEIVED); 818 tp->iss = sc->sc_iss; 819 tp->irs = sc->sc_irs; 820 tcp_rcvseqinit(tp); 821 tcp_sendseqinit(tp); |
822 blk = sototcpcb(lso)->t_fb; 823 if (blk != tp->t_fb) { 824 /* 825 * Our parents t_fb was not the default, 826 * we need to release our ref on tp->t_fb and 827 * pickup one on the new entry. 828 */ 829 struct tcp_function_block *rblk; 830 831 rblk = find_and_ref_tcp_fb(blk); 832 KASSERT(rblk != NULL, 833 ("cannot find blk %p out of syncache?", blk)); 834 if (tp->t_fb->tfb_tcp_fb_fini) 835 (*tp->t_fb->tfb_tcp_fb_fini)(tp); 836 refcount_release(&tp->t_fb->tfb_refcnt); 837 tp->t_fb = rblk; 838 if (tp->t_fb->tfb_tcp_fb_init) { 839 (*tp->t_fb->tfb_tcp_fb_init)(tp); 840 } 841 } |
|
820 tp->snd_wl1 = sc->sc_irs; 821 tp->snd_max = tp->iss + 1; 822 tp->snd_nxt = tp->iss + 1; 823 tp->rcv_up = sc->sc_irs + 1; 824 tp->rcv_wnd = sc->sc_wnd; 825 tp->rcv_adv += tp->rcv_wnd; 826 tp->last_ack_sent = tp->rcv_nxt; 827 --- 1198 unchanged lines hidden --- | 842 tp->snd_wl1 = sc->sc_irs; 843 tp->snd_max = tp->iss + 1; 844 tp->snd_nxt = tp->iss + 1; 845 tp->rcv_up = sc->sc_irs + 1; 846 tp->rcv_wnd = sc->sc_wnd; 847 tp->rcv_adv += tp->rcv_wnd; 848 tp->last_ack_sent = tp->rcv_nxt; 849 --- 1198 unchanged lines hidden --- |