git: 24cf7a8d6285 - main - inpcb: provide pcbinfo pointer argument to inp_apply_all()

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Wed, 19 Oct 2022 22:18:42 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=24cf7a8d62856552fa800ad81b6f89ec9cdf91be

commit 24cf7a8d62856552fa800ad81b6f89ec9cdf91be
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2022-10-19 22:15:53 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2022-10-19 22:15:53 +0000

    inpcb: provide pcbinfo pointer argument to inp_apply_all()
    
    Allows to clear inpcb layer of TCP knowledge.
---
 sys/netinet/in_pcb.c  | 5 +++--
 sys/netinet/in_pcb.h  | 3 ++-
 sys/netinet/toecore.c | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 10e36760825b..3348526b144e 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -2694,9 +2694,10 @@ inp_unlock_assert(struct inpcb *inp)
 #endif
 
 void
-inp_apply_all(void (*func)(struct inpcb *, void *), void *arg)
+inp_apply_all(struct inpcbinfo *pcbinfo,
+    void (*func)(struct inpcb *, void *), void *arg)
 {
-	struct inpcb_iterator inpi = INP_ALL_ITERATOR(&V_tcbinfo,
+	struct inpcb_iterator inpi = INP_ALL_ITERATOR(pcbinfo,
 	    INPLOOKUP_WLOCKPCB);
 	struct inpcb *inp;
 
diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h
index a72ae5742d4e..2ac1bb227613 100644
--- a/sys/netinet/in_pcb.h
+++ b/sys/netinet/in_pcb.h
@@ -546,7 +546,8 @@ void inp_unlock_assert(struct inpcb *);
 #define	inp_unlock_assert(inp)	do {} while (0)
 #endif
 
-void	inp_apply_all(void (*func)(struct inpcb *, void *), void *arg);
+void	inp_apply_all(struct inpcbinfo *, void (*func)(struct inpcb *, void *),
+	    void *arg);
 int 	inp_ip_tos_get(const struct inpcb *inp);
 void 	inp_ip_tos_set(struct inpcb *inp, int val);
 struct socket *
diff --git a/sys/netinet/toecore.c b/sys/netinet/toecore.c
index a078d9cea51f..892c0e71a0be 100644
--- a/sys/netinet/toecore.c
+++ b/sys/netinet/toecore.c
@@ -322,7 +322,7 @@ register_toedev(struct toedev *tod)
 	registered_toedevs++;
 	mtx_unlock(&toedev_lock);
 
-	inp_apply_all(toe_listen_start, tod);
+	inp_apply_all(&V_tcbinfo, toe_listen_start, tod);
 
 	return (0);
 }