diff options
author | ngie <ngie@FreeBSD.org> | 2015-12-17 06:55:25 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2015-12-17 06:55:25 +0000 |
commit | 490921132f201193a73d81699cb455aa2ae87357 (patch) | |
tree | 447ebf673b9e1d362dbcf1b55fd34fa0de86d693 /sys/netinet/tcp_syncache.c | |
parent | 3fed53d02350ae9cbd7b2786b72b83d2e292b8d1 (diff) | |
parent | a7e4d91c2357d6f2c732cccc35fd4ddda5f2d58e (diff) | |
download | FreeBSD-src-490921132f201193a73d81699cb455aa2ae87357.zip FreeBSD-src-490921132f201193a73d81699cb455aa2ae87357.tar.gz |
MFhead @ r292396
Diffstat (limited to 'sys/netinet/tcp_syncache.c')
-rw-r--r-- | sys/netinet/tcp_syncache.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index e5a38d5..8ad1b22 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> #include <sys/hash.h> +#include <sys/refcount.h> #include <sys/kernel.h> #include <sys/sysctl.h> #include <sys/limits.h> @@ -626,6 +627,7 @@ done: static struct socket * syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m) { + struct tcp_function_block *blk; struct inpcb *inp = NULL; struct socket *so; struct tcpcb *tp; @@ -817,6 +819,26 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m) tp->irs = sc->sc_irs; tcp_rcvseqinit(tp); tcp_sendseqinit(tp); + blk = sototcpcb(lso)->t_fb; + if (blk != tp->t_fb) { + /* + * Our parents t_fb was not the default, + * we need to release our ref on tp->t_fb and + * pickup one on the new entry. + */ + struct tcp_function_block *rblk; + + rblk = find_and_ref_tcp_fb(blk); + KASSERT(rblk != NULL, + ("cannot find blk %p out of syncache?", blk)); + if (tp->t_fb->tfb_tcp_fb_fini) + (*tp->t_fb->tfb_tcp_fb_fini)(tp); + refcount_release(&tp->t_fb->tfb_refcnt); + tp->t_fb = rblk; + if (tp->t_fb->tfb_tcp_fb_init) { + (*tp->t_fb->tfb_tcp_fb_init)(tp); + } + } tp->snd_wl1 = sc->sc_irs; tp->snd_max = tp->iss + 1; tp->snd_nxt = tp->iss + 1; |