git: 7a6319ece24f - stable/13 - if_vxlan(4): Use static initializers
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 03 Feb 2025 12:28:18 UTC
The branch stable/13 has been updated by zlei:
URL: https://cgit.FreeBSD.org/src/commit/?id=7a6319ece24f2c672ca074c1266364ac018b3ef2
commit 7a6319ece24f2c672ca074c1266364ac018b3ef2
Author: Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2025-01-24 09:37:24 +0000
Commit: Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2025-02-03 12:27:05 +0000
if_vxlan(4): Use static initializers
MFC after: 1 week
(cherry picked from commit 5e0dbbc238e2e935c68e293314a90f2ce6e6ef16)
(cherry picked from commit e2b6e11583eb13ee09a7cb0babc2a1d8f3bd952a)
---
sys/net/if_vxlan.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c
index 827772063ede..f9478da983d8 100644
--- a/sys/net/if_vxlan.c
+++ b/sys/net/if_vxlan.c
@@ -418,7 +418,8 @@ static struct mtx vxlan_list_mtx;
#define VXLAN_LIST_LOCK() mtx_lock(&vxlan_list_mtx)
#define VXLAN_LIST_UNLOCK() mtx_unlock(&vxlan_list_mtx)
-static LIST_HEAD(, vxlan_socket) vxlan_socket_list;
+static LIST_HEAD(, vxlan_socket) vxlan_socket_list =
+ LIST_HEAD_INITIALIZER(vxlan_socket_list);
static eventhandler_tag vxlan_ifdetach_event_tag;
@@ -3601,12 +3602,10 @@ vxlan_tunable_int(struct vxlan_softc *sc, const char *knob, int def)
static void
vxlan_ifdetach_event(void *arg __unused, struct ifnet *ifp)
{
- struct vxlan_softc_head list;
+ struct vxlan_softc_head list = LIST_HEAD_INITIALIZER(list);
struct vxlan_socket *vso;
struct vxlan_softc *sc, *tsc;
- LIST_INIT(&list);
-
if (ifp->if_flags & IFF_RENAMING)
return;
if ((ifp->if_flags & IFF_MULTICAST) == 0)
@@ -3634,7 +3633,6 @@ vxlan_load(void)
{
mtx_init(&vxlan_list_mtx, "vxlan list", NULL, MTX_DEF);
- LIST_INIT(&vxlan_socket_list);
vxlan_ifdetach_event_tag = EVENTHANDLER_REGISTER(ifnet_departure_event,
vxlan_ifdetach_event, NULL, EVENTHANDLER_PRI_ANY);
vxlan_cloner = if_clone_simple(vxlan_name, vxlan_clone_create,