diff options
| author | Stephan Uphoff <ups@FreeBSD.org> | 2006-07-18 22:34:27 +0000 |
|---|---|---|
| committer | Stephan Uphoff <ups@FreeBSD.org> | 2006-07-18 22:34:27 +0000 |
| commit | d915b2801534ecb14fceb9ac894c9aa3fb65d6c8 (patch) | |
| tree | 2e39fd9d815a6efa63bdabd6bfed00c38e05310a /sys/netinet/tcp_subr.c | |
| parent | 0c6d6356bab47061765c0f24d769afe069d9e94b (diff) | |
Notes
Diffstat (limited to 'sys/netinet/tcp_subr.c')
| -rw-r--r-- | sys/netinet/tcp_subr.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 89bd41ca5768..676b22e15d94 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -262,6 +262,14 @@ tcp_zone_change(void *tag) uma_zone_set_max(tcptw_zone, maxsockets / 5); } +static int +tcp_inpcb_init(void *mem, int size, int flags) +{ + struct inpcb *inp = (struct inpcb *) mem; + INP_LOCK_INIT(inp, "inp", "tcpinp"); + return (0); +} + void tcp_init(void) { @@ -290,7 +298,7 @@ tcp_init(void) tcbinfo.porthashbase = hashinit(hashsize, M_PCB, &tcbinfo.porthashmask); tcbinfo.ipi_zone = uma_zcreate("inpcb", sizeof(struct inpcb), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + NULL, NULL, tcp_inpcb_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); uma_zone_set_max(tcbinfo.ipi_zone, maxsockets); #ifdef INET6 #define TCP_MINPROTOHDR (sizeof(struct ip6_hdr) + sizeof(struct tcphdr)) @@ -989,6 +997,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) error = 0; for (i = 0; i < n; i++) { inp = inp_list[i]; + INP_LOCK(inp); if (inp->inp_gencnt <= gencnt) { struct xtcpcb xt; void *inp_ppcb; @@ -1012,8 +1021,11 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) xt.xt_socket.xso_protocol = IPPROTO_TCP; } xt.xt_inp.inp_gencnt = inp->inp_gencnt; + INP_UNLOCK(inp); error = SYSCTL_OUT(req, &xt, sizeof xt); - } + } else + INP_UNLOCK(inp); + } if (!error) { /* |
