From nobody Thu May 1 08:24:05 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 4Zp6XQ54Rhz5tpxf; Thu, 01 May 2025 08:24:06 +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 4Zp6XQ1gYVz3bSx; Thu, 01 May 2025 08:24:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1746087846; 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=UYcpJoigazAuYe6i8Nn966XlnYyWZDJMJYw6iMOiqms=; b=p5xuBra7fIYmt/Q7rUFmMn2hzkgU27Sj0LbiZfh2nAM64mzCafBPBDBKVE4NDvY4R6J911 BzuW9bI3y+kDVIwZvsNxGNaWcohUg6C5pXH2IyyVt+/jgaLAAuUAs6KHzdB2hZps6FAcir nwntF89im2Hp+Mc+bjDRh2eu4F6smf30I4jad2a5PKoX66szdpGeLojL6k7En0ydS/GFHM V7fcaA/3a5VQO2nYGvpNGltkdBZWNe1qvmky9CFKTKWbVW6EtCRq7nxLPFyjEn56PkgZxK vu82TN3LEgvDHsYecLHB3TZQ2zA84SBpKlwekUt5MctU8IwrD8EhIAfUEYHy3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1746087846; 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=UYcpJoigazAuYe6i8Nn966XlnYyWZDJMJYw6iMOiqms=; b=a3XZgTMSuLynKaOD3QWw0i27u2DjpJY/J2lRKdwrehPc+mtt38Ih2B9dkRR2vOS71hSkT0 6hkzFzHeaO89CkfkjkWfWaTuvG8K7oc5DJhdUQDAtlgfeUVqaev7krQIhTwUNq/QnCrHGY HQeGbI7LHdpguNwPZhGF0lAIMgVvzuBmAIXBP4kNHxOdcXQFApIzx61+pRM3YCM5jfixs7 70MPDrp7XrT4Rr2oSPoEOnuZPSxhxPs3I5ELOee9wSkeHSaKVWLwGfUxH9OWQVUsd48sBp ep/Or7vuc7YHoEiS3+AeeyPSamCcN8IWu/BcgbeUPBUAXzvpOZUa5kwt0JN1xw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1746087846; a=rsa-sha256; cv=none; b=VKct3Ou4Q1qhqjYCguIGB/ew8ZW/DBrWf9D6JWmfYxIU9EyhD1nrZ8mOF17SISW+NFE4Kq Mlqs7WURS6PNy6kjpPfXG30XUCGoNrB6zZFbYvjoUb1qRDEAqEggHVA8eRmYeJOc0c9IXY 7XutlY+EEbBx80XW32Rg4dniBzNBnGaqFhid8uQgX9LvH4MQ0HWS3aduBg65vt2TTW7W81 DnJywxFPNAVBqfJbBlqcBM1MHLmi2sHKR0wuc5FFnJ1a0Mv89ecymTeqv/f0xMrRICiCQr C56TSPdVlJ6w+tmVaEISDbjSo9+o4urqDEzegs4wyl9RywXpcGwPGRz6u8y23A== 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 4Zp6XQ0fy9z4pL; Thu, 01 May 2025 08:24:06 +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 5418O5PE079766; Thu, 1 May 2025 08:24:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5418O5dV079763; Thu, 1 May 2025 08:24:05 GMT (envelope-from git) Date: Thu, 1 May 2025 08:24:05 GMT Message-Id: <202505010824.5418O5dV079763@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: d2c2d6d6b09e - main - igmp: apply net.inet.igmp.default_version to existing interfaces 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d2c2d6d6b09e8a059dffd6b6c7513d0925a8753d Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d2c2d6d6b09e8a059dffd6b6c7513d0925a8753d commit d2c2d6d6b09e8a059dffd6b6c7513d0925a8753d Author: Olivier BLANC AuthorDate: 2025-03-14 18:55:55 +0000 Commit: Kristof Provost CommitDate: 2025-05-01 07:31:21 +0000 igmp: apply net.inet.igmp.default_version to existing interfaces IGMP requires hosts to use the lowest version they have seen on the network. When net.inet.igmp.default_version is changed, we do not change IGMP version used by interface even if the interface use an higher version than V_igmp_default_version. So we could send IGMPv3 even if the user has requested IGMPv2 or IGMPv1 via the sysctl. Change IGMP version for each interface when V_igmp_default_version is smaller than the version used by the interface. Pull Request: https://github.com/freebsd/freebsd-src/pull/1615 Differential Revision: https://reviews.freebsd.org/D50071 --- sys/netinet/igmp.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c index 5082b6294ebb..299f3c2e02bb 100644 --- a/sys/netinet/igmp.c +++ b/sys/netinet/igmp.c @@ -402,32 +402,43 @@ out: static int sysctl_igmp_default_version(SYSCTL_HANDLER_ARGS) { + struct epoch_tracker et; int error; int new; + struct igmp_ifsoftc *igi; error = sysctl_wire_old_buffer(req, sizeof(int)); if (error) return (error); - IGMP_LOCK(); - new = V_igmp_default_version; error = sysctl_handle_int(oidp, &new, 0, req); if (error || !req->newptr) - goto out_locked; + return (error); - if (new < IGMP_VERSION_1 || new > IGMP_VERSION_3) { - error = EINVAL; - goto out_locked; - } + if (new < IGMP_VERSION_1 || new > IGMP_VERSION_3) + return (EINVAL); + + IN_MULTI_LIST_LOCK(); + IGMP_LOCK(); + NET_EPOCH_ENTER(et); - CTR2(KTR_IGMPV3, "change igmp_default_version from %d to %d", - V_igmp_default_version, new); + if (V_igmp_default_version != new) { + CTR2(KTR_IGMPV3, "change igmp_default_version from %d to %d", + V_igmp_default_version, new); - V_igmp_default_version = new; + V_igmp_default_version = new; -out_locked: + LIST_FOREACH(igi, &V_igi_head, igi_link) { + if (igi->igi_version > V_igmp_default_version){ + igmp_set_version(igi, V_igmp_default_version); + } + } + } + + NET_EPOCH_EXIT(et); + IN_MULTI_LIST_UNLOCK(); IGMP_UNLOCK(); return (error); }