From 4e7a375804e5ad4b244ce9a035fa971cbf2f0944 Mon Sep 17 00:00:00 2001 From: ItzBlinkzy Date: Sun, 28 Sep 2025 18:21:41 +0100 Subject: [PATCH] IfAPI: Added missing accessor for if_home_vnet Reviewed by: kp Signed-off-by: Kevin Irabor --- share/man/man9/ifnet.9 | 10 +++++++++- sys/net/if.c | 6 ++++++ sys/net/if_var.h | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/share/man/man9/ifnet.9 b/share/man/man9/ifnet.9 index 3c45e4f29e2..ac059b59eb8 100644 --- a/share/man/man9/ifnet.9 +++ b/share/man/man9/ifnet.9 @@ -26,7 +26,7 @@ .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd December 10, 2024 +.Dd September 29, 2025 .Dt IFNET 9 .Os .Sh NAME @@ -253,6 +253,8 @@ .Fn if_getlladdr "const if_t ifp" .Ft struct vnet * .Fn if_getvnet "const if_t ifp" +.Ft struct vnet * +.Fn if_gethomevnet "const if_t ifp" .Ft void * .Fn if_gethandle "u_char" .Ft void @@ -516,6 +518,12 @@ or A pointer to the virtual network stack instance. This is initialized by .Fn if_attach . +.It Fn if_gethomevnet +.Pq Vt "struct vnet *" +A pointer to the parent virtual network stack, +where this struct ifnet originates from. +This is initialized by +.Fn if_attach . .It Fn if_gethandle .It Fn if_vlancap .It Fn if_getcounter diff --git a/sys/net/if.c b/sys/net/if.c index b6a798aa0fa..6a68d627c07 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -5116,6 +5116,12 @@ if_getvnet(if_t ifp) return (ifp->if_vnet); } +struct vnet * +if_gethomevnet(if_t ifp) +{ + return (ifp->if_home_vnet); +} + void * if_getafdata(if_t ifp, int af) { diff --git a/sys/net/if_var.h b/sys/net/if_var.h index f2df612b19c..e71fe798fde 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -648,6 +648,7 @@ u_int16_t if_getvtag(struct mbuf *m); int if_vlantrunkinuse(if_t ifp); char *if_getlladdr(const if_t ifp); struct vnet *if_getvnet(const if_t ifp); +struct vnet *if_gethomevnet(const if_t ifp); void *if_gethandle(u_char); void if_vlancap(if_t ifp); int if_transmit(if_t ifp, struct mbuf *m);