diff options
| author | Zhenlei Huang <zlei@FreeBSD.org> | 2024-10-22 04:32:24 +0000 |
|---|---|---|
| committer | Zhenlei Huang <zlei@FreeBSD.org> | 2024-10-22 04:32:24 +0000 |
| commit | d1d839d0b593541174ca48c675c9eff4ddb4715e (patch) | |
| tree | 1af7047df3110d66cf5cf18ddf48eba5d3576fc4 | |
| parent | caa309c8811d62a24cd07e3a1f6e9095eaf10c90 (diff) | |
ifnet: Assert that we are assigning network stack correctly
It makes no sense to assign NULL vnet to an interface when the kernel
option VIMAGE is enabled. Add an assertion to catch that.
This will also help diagnosing problem report [1] and [2].
1. https://bugs.freebsd.org/275381
2. https://bugs.freebsd.org/282168
Reviewed by: kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D46982
| -rw-r--r-- | sys/net/if.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index ebad5c5d16e5..8dc212ae4ac7 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -832,6 +832,7 @@ if_attach_internal(struct ifnet *ifp, bool vmove) MPASS(ifindex_table[ifp->if_index].ife_ifnet == ifp); #ifdef VIMAGE + CURVNET_ASSERT_SET(); ifp->if_vnet = curvnet; if (ifp->if_home_vnet == NULL) ifp->if_home_vnet = curvnet; |
