The branch stable/13 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=e59f60d3c08c263f14bbd3cf7dde499e80d7335c
commit e59f60d3c08c263f14bbd3cf7dde499e80d7335c Author: Zhenlei Huang <z...@freebsd.org> AuthorDate: 2025-06-26 16:37:13 +0000 Commit: Zhenlei Huang <z...@freebsd.org> CommitDate: 2025-07-08 10:03:28 +0000 if_vlan: Fix up if_type before attaching the interface ether_ifattach() does not touch if_type, so it is not mandatory to fix the if_type after ether_ifattach(). Without this change, the event listeners, e.g. netlink, will see wrong interface type IFT_ETHER rather than the correct one IFT_L2VLAN. There is also a potential race that other threads see inconsistent interface type, i.e. initially IFT_ETHER and eventually IFT_L2VLAN. As a nice effect, this change eliminates the memory allocation for if_hw_addr, as vlan(4) interfaces do not support setting or retrieving the hardware MAC address yet [1]. [1] ddae57504b79 Persistently store NIC's hardware MAC address, and add a way to retrive it MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D50914 (cherry picked from commit a19b353d354d4ef808965c53253103cb6e7e6708) (cherry picked from commit ff54b680383bb0f212e813b74e7a3f76423d2238) --- sys/net/if_vlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index b098d09a8d9f..b45b8a8ac561 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1138,10 +1138,10 @@ vlan_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params) ifp->if_ratelimit_query = vlan_ratelimit_query; #endif ifp->if_flags = VLAN_IFFLAGS; + ifp->if_type = IFT_L2VLAN; ether_ifattach(ifp, eaddr); /* Now undo some of the damage... */ ifp->if_baudrate = 0; - ifp->if_type = IFT_L2VLAN; ifp->if_hdrlen = ETHER_VLAN_ENCAP_LEN; ifa = ifp->if_addr; sdl = (struct sockaddr_dl *)ifa->ifa_addr;