git: 4e7a375804e5 - main - IfAPI: Added missing accessor for if_home_vnet
Date: Mon, 29 Sep 2025 21:16:59 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=4e7a375804e5ad4b244ce9a035fa971cbf2f0944
commit 4e7a375804e5ad4b244ce9a035fa971cbf2f0944
Author: ItzBlinkzy <kitey13579@gmail.com>
AuthorDate: 2025-09-28 17:21:41 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-09-29 21:15:55 +0000
IfAPI: Added missing accessor for if_home_vnet
Reviewed by: kp
Signed-off-by: Kevin Irabor <kevin.irabor04@gmail.com>
---
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 3c45e4f29e2d..ac059b59eb81 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 b6a798aa0fab..6a68d627c07f 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 f2df612b19c1..e71fe798fdec 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);