From nobody Thu May 22 15:01:13 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 4b3BLy3MyRz5wmwG; Thu, 22 May 2025 15:01:14 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4b3BLy0dQvz3LtQ; Thu, 22 May 2025 15:01:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1747926074; 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=U/GtoKQ8E6Gij/ATYPijQc6rAqHr6WME7cWY49S8ZhQ=; b=OTWxLFjif7UgZJnYOVHjw10cxwFE4Ptc+TqRj/fP2/9e6xkHy4EC2kW1zXln+6uJZaI6Nw 7nFg5BjepSBhXYcHX/lHF8GC0hUSU3R0MCj40C4SJL4mh+Xvrz+y4hFgYcg9SBFuKbAToh 21Suvpk/PtqvzJNwTzzECxBPVPDkDadpM2+yJXX7+HyM8ZcrvsOmJahPtyOn6xJNnKJmZf UsvFC16LQCLFNim5F+nSZcSfVtGm4u72NebyRsN8JthXN/4zQhof4at136Tu4G8WsSIVtd u+0gbWoInb7sZKbfiKES5JQWdj+ppuXcTVzCbAruwW3muuLXsaL1YeFQuLSlgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1747926074; 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=U/GtoKQ8E6Gij/ATYPijQc6rAqHr6WME7cWY49S8ZhQ=; b=g2kkD8C1uTHB75Vmz98fV/4FMjezPUgRQwS4zUDTlmMoG34nF+f1fMVBpKtz0N/grnuHaW /1WdY4w/Rg8CDdpHiVVAn2lrRQIziCFd8A/QikjUssqo5mq+F0rS5UiuGJz+ubIu1GHhb+ Sm4jlWFgds6AhrKgtxILh/LrQiVoB7MLoEo/xRVDDzhHt5Qhg4drHKS91rbrDf2EvP1jdK 7WVoMyJiphUxd0VF3gV5If/NMv2g+6EK1EDEgSOfebk1uKncrQ+7w3YJxsdGK8H8kFmc0C 475WcGbkMnEe73b8VlQq+h49gHO4y1nsu0/TQmm2g89VIW7DMZ3jtHZfywyM5g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1747926074; a=rsa-sha256; cv=none; b=QvODDmLRZEEgirvUV5BT6ImqyvKfEclxEByH14TCKRFU+zD8HEm5mvc0t+wbGbQVyhYwwt Tm5KjjhyFrratCVrYa4Il0wsp2sCtkrsUnshd+ON37BVFn8Y0vLUGGkyuoOej877apzsqp ZarOPdBZqdq/sv7MooROl1rxWvPwBykbNah+3KbImZ+/yddtAM3jFTAycJDsHn9vMSv5t0 0gLiSGrGphY1saMQduFAaMJyr4HfKcURYod5l1AFHjXzHUspfexqNBSlyMN8AH4GOOe1A1 t9/5jLb57NG/q3ayFa96vqHkUNAWk0mmweRDegF4oblzHCGZTpWB/zxj0YRyVg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4b3BLy0C52z943; Thu, 22 May 2025 15:01:14 +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 54MF1DX2064328; Thu, 22 May 2025 15:01:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 54MF1Dxc064325; Thu, 22 May 2025 15:01:13 GMT (envelope-from git) Date: Thu, 22 May 2025 15:01:13 GMT Message-Id: <202505221501.54MF1Dxc064325@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: 098b5d4dc744 - main - ifnet: Initialize the address family dependent data region earlier 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: 098b5d4dc744283a90b2d80c11395ecc18a84084 Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=098b5d4dc744283a90b2d80c11395ecc18a84084 commit 098b5d4dc744283a90b2d80c11395ecc18a84084 Author: Zhenlei Huang AuthorDate: 2025-05-22 15:00:05 +0000 Commit: Zhenlei Huang CommitDate: 2025-05-22 15:00:05 +0000 ifnet: Initialize the address family dependent data region earlier if_link_ifnet() adds the interface to the global network interface list, and it is a natural synchronization point. With this change, any threads that obtain the reference of the interface via ifunit(), ifunit_ref() etc., will be guaranteed to see the address family dependent data rightly. The issue [1] reported by Mike Belanger also hints the potential race. MFC note: this change depends on e64fe5ad3a23, as calculating the max IPv6 MTU through all the interfaces requires the current interface to be added to the global network interface list firstly. [1] https://lists.freebsd.org/archives/freebsd-net/2025-May/006817.html Reviewed by: glebius MFC after: 1 month MFC with: e64fe5ad3a23 netinet6: Remove a set but not used global variable in6_maxmtu Differential Revision: https://reviews.freebsd.org/D49358 --- sys/net/if.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 853fc3c78fce..0255c27a3136 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -946,11 +946,11 @@ if_attach_internal(struct ifnet *ifp, bool vmove) } #endif - if_link_ifnet(ifp); - if (domain_init_status >= 2) if_attachdomain1(ifp); + if_link_ifnet(ifp); + EVENTHANDLER_INVOKE(ifnet_arrival_event, ifp); if (IS_DEFAULT_VNET(curvnet)) devctl_notify("IFNET", ifp->if_xname, "ATTACH", NULL);