From nobody Thu Jun 26 16:38:04 2025 X-Original-To: dev-commits-src-main@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 4bSkrY1mDBz60lLf; Thu, 26 Jun 2025 16:38:05 +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 4bSkrY0mqLz3tTw; Thu, 26 Jun 2025 16:38:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750955885; 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=Zdg7FqA8qs+WCx07/9RAnkcbMLNDv6h2Oaar2+kruxk=; b=TVkhfi69UtdhH2od0OAoKdmPMul8nkghcodJicvlY9OFW4vCeveg4HlknvDWFb7lCgW0GX YhUEmEdGUSxApvXrzpsfLLL77ZcYhBrxzctgGuz/90YhGwVcq1SHLaUfBmVEDRDI42BqM9 n1IEMh7toRU0QLNjpRTAhCZT6bDrP0jAs3Sq12gpuD4D4bzJL0tfSEMxvSiIdKoAk1Ag7S WR2LOnFqjJHCbWmOID3W2g1QvWS4Q5RjPrZ2ZkcijMyO6IOoMjWZngoTuBNQv41WW2+yhE QvMdsrZdfR1Dw5KkOJ4j4r0I/q1VZuG5YCgIyE5sbR4QCCV4nsyKHdH6d8uywg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750955885; 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=Zdg7FqA8qs+WCx07/9RAnkcbMLNDv6h2Oaar2+kruxk=; b=qQaVDU7xt9ObgbuyCDH7d/8nZlVpQAKr6D95bRasDqOOJ2eaMYRQu78lDNRX3LoF3RgXae ebD1SaGzfiFxoatjTm8C9tCXNmRQPjPiCuaD/9kgfx99dFOz/IB+QVjlEn2r4tw2yRkuvj 0W/vzdoKVskIJZsISNnW5qcKBsdNhAxDHDSWodvr7qyCBz2oEggJCA9RV2oG9AM3lgbJ6e frTLLtuomToaA2tbgKz/Oaihh+FSf7GDJ05DzZU8qtyUEWJBjlO7t/n/gRy+pJAC+yl6N6 nHQgFRhMkRgkjG73tEgc9DukxWrp5pQCc4AvUN1216pr49+D/8e7Se6SpF9xuQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750955885; a=rsa-sha256; cv=none; b=e7szPsfUtSpXn8AYoxhRcXwUKkGWjCA10jlCSi0OlGpcd+Iif9tvbUceZujd4Jc/rwB8BK IOPNOiQyCYyNROe/H8oeNvc42WYgER6+vF8ITt75S8j08rG4WLiDRQhvAk90Gufsus8g/E aUS5CM3syast/M7HOuXvPWjbEVapl43HatNNUa11Igo87Db0Yw38mt8J/eqRCNNYRqSEyk UJXglSLPAvpRAxS/b8J43MywDskGJoVw3He515ClZ33DI5RdhWl7aKZ1G32ouWCWhDKeH0 dy6Fw3ckivgZuSn4sFuW7uPbyPy2waB2IruwaohjllNM45qsYsQru3SrmhUikA== 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 4bSkrY033Bz19N7; Thu, 26 Jun 2025 16:38:05 +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 55QGc4Ll004756; Thu, 26 Jun 2025 16:38:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55QGc4kg004753; Thu, 26 Jun 2025 16:38:04 GMT (envelope-from git) Date: Thu, 26 Jun 2025 16:38:04 GMT Message-Id: <202506261638.55QGc4kg004753@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: a19b353d354d - main - if_vlan: Fix up if_type before attaching the interface List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: a19b353d354d4ef808965c53253103cb6e7e6708 Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=a19b353d354d4ef808965c53253103cb6e7e6708 commit a19b353d354d4ef808965c53253103cb6e7e6708 Author: Zhenlei Huang AuthorDate: 2025-06-26 16:37:13 +0000 Commit: Zhenlei Huang CommitDate: 2025-06-26 16:37:13 +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 --- 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 9561ae5c316c..e9e1c82cb688 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1177,10 +1177,10 @@ vlan_clone_create(struct if_clone *ifc, char *name, size_t len, 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;