aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2023-04-12 08:52:53 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2023-04-12 08:52:53 +0000
commit73c48d9d8f89f066db5c5eef967a936d6b7f2d1f (patch)
tree898e5425919d20d1904ee30624794e0d3e8a4446
parent305edaa47918a559de46a5d72060644009f1875c (diff)
downloadsrc-73c48d9d8f89f066db5c5eef967a936d6b7f2d1f.tar.gz
src-73c48d9d8f89f066db5c5eef967a936d6b7f2d1f.zip
tcp: fix deregistering stacks when vnets are used
This fixes a bug where stacks could not be deregistered when end points in the non-default vnet are using it. Reviewed by: glebius, zlei MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D39514
-rw-r--r--sys/netinet/tcp_subr.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 36112a101fa8..be78396260c7 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -1355,8 +1355,6 @@ deregister_tcp_functions(struct tcp_function_block *blk, bool quiesce,
* to the default stack.
*/
if (force && blk->tfb_refcnt) {
- struct inpcb_iterator inpi = INP_ALL_ITERATOR(&V_tcbinfo,
- INPLOOKUP_WLOCKPCB);
struct inpcb *inp;
struct tcpcb *tp;
VNET_ITERATOR_DECL(vnet_iter);
@@ -1366,6 +1364,9 @@ deregister_tcp_functions(struct tcp_function_block *blk, bool quiesce,
VNET_LIST_RLOCK();
VNET_FOREACH(vnet_iter) {
CURVNET_SET(vnet_iter);
+ struct inpcb_iterator inpi = INP_ALL_ITERATOR(&V_tcbinfo,
+ INPLOOKUP_WLOCKPCB);
+
while ((inp = inp_next(&inpi)) != NULL) {
tp = intotcpcb(inp);
if (tp == NULL || tp->t_fb != blk)