From nobody Tue Jul 8 10:05:04 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bbxYX5F4vz60j50; Tue, 08 Jul 2025 10:05:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bbxYX4Xw5z3GD3; Tue, 08 Jul 2025 10:05:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751969104; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=arH0TwZISjVDPeGXf6Ji8nCECeuzzQ3CewZ1ia+Yfxk=; b=IqRTJ0Tz0qJS4kjceQi3IVkb7X6HADPeXRyQK6bS8MAxN1xAPpSTeH+iS+WN/rwquXF8rl nozrc8n4+ykfuYpgQn5Jp0Y64E5tJoB9Eu+HGPx1JK6647mAX8EOxuktvCu0L9l3AzG7Ue oKHEnYXEWbCGHczGEnQG9hEk4ROPiidDkFGJ8uxbdEuHjUhD0IdPR8gGaNDz+vipefyKPU +G4ZvrtL6scYqoKogcVDfAT3x9V5buJ4RSD12oFq89LHM9swxbytK0qHI0Xs83COQ+KhBh SIh2sYwGTkRcH1hdhKKcUMCOviq2I97wEO3g6AGxBXlxH7JtrH5qgD+n+k4m8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751969104; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=arH0TwZISjVDPeGXf6Ji8nCECeuzzQ3CewZ1ia+Yfxk=; b=b9AkSGgKwMVW5Abtyeg6TfaRX6HaJMxnGNqLeCfWKxrhQ80zM82Un3Ze31uGGtFDw9HRKV wqW+sfLSvb98Q5lY04Grf3soMEwEfzFUqdrQM6MGacYpyCI9fd4kbblZFXCL+YKyj8jZlS DMN6HTMJ7B/pFPOG3g/cBSK8G5rgA0XG6fbJbCzLUHSmz9Rir/6BMg4Q5Gdfv7mAuwjNJf a3vcu1eM2VejD9ycBsFYW0/90Eoea2LBLAQ48Tb3QI7w2OiiM3U7v9ctWva2bNyaXzocP/ oESdGRYQiQSpfVG4NdaNZSf80EMaMG21/k1HgHw2MWVICxFABJyhc3tmIEQ5+w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751969104; a=rsa-sha256; cv=none; b=UZ9Xz+xPu6y5OrG5fIvh9yuLWdw50YyOnzKKZWvv4PDAN+PQz/PDT2KJiK+C2pFLz2sge0 4ONwVMq4p0YR/rlBcCRewgp+9NSahLoGafxWMg1dbyNw6maK0GuHJD6k1yE6tFE/+lnBGX sHptA/xDSfoa1wuLUzTzkKDVLKLK1QMSFdCM5X+QAqRkjBLWiU3k74SQvOcDJaS0TazHDc HUjUo4SG9Ud0yQlNd78rdqLPxaZDj2lFBehfMIj/nF40XviskRAKgSWgipL0xLxd71BOvQ dPqTpZxVolWqrN+5OB0Bq6rOMKl/HL9emC4NAbUB85xBmwPZeuzQmPT1skmNJA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bbxYX44tTzXjc; Tue, 08 Jul 2025 10:05:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 568A54Ew067293; Tue, 8 Jul 2025 10:05:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 568A54Cf067290; Tue, 8 Jul 2025 10:05:04 GMT (envelope-from git) Date: Tue, 8 Jul 2025 10:05:04 GMT Message-Id: <202507081005.568A54Cf067290@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: e59f60d3c08c - stable/13 - if_vlan: Fix up if_type before attaching the interface List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e59f60d3c08c263f14bbd3cf7dde499e80d7335c Auto-Submitted: auto-generated The branch stable/13 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=e59f60d3c08c263f14bbd3cf7dde499e80d7335c commit e59f60d3c08c263f14bbd3cf7dde499e80d7335c Author: Zhenlei Huang AuthorDate: 2025-06-26 16:37:13 +0000 Commit: Zhenlei Huang 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;