From nobody Sun Jul 31 19:29:36 2022 X-Original-To: net@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 4Lwrt917T5z4Y6r7 for ; Sun, 31 Jul 2022 19:29:37 +0000 (UTC) (envelope-from bugzilla-noreply@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Lwrt905q0z3MSQ for ; Sun, 31 Jul 2022 19:29:37 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 4Lwrt86FH2z14tn for ; Sun, 31 Jul 2022 19:29:36 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 26VJTaOW049118 for ; Sun, 31 Jul 2022 19:29:36 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 26VJTamN049117 for net@FreeBSD.org; Sun, 31 Jul 2022 19:29:36 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: net@FreeBSD.org Subject: [Bug 265540] EADDRNOTAVAIL when leaving IPv6 multicast group and ipv6_mreq.ipv6mr_interface=0 Date: Sun, 31 Jul 2022 19:29:36 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: dmgk@freebsd.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: net@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659295777; 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=ZxsAv1zVFro3kUQvJaRbwnHGfeT5I10DKE6TKqd4tKc=; b=W/Au9YZ9bfCX2N5Hvqh6i3mNCswKqF4XlAlhYHkvvI4HseTCf6/k4YjvLxDPODZ1eDwgcH rjbTWsbJUXms5IrXrH0qgXBRSXrTmwIdcAGFZC9C3FcnyJFRIGvwbaPzfDgUEvNwM8SEm1 MuoMx+b7cFcKMshX8wpTDl69TTcvZrmEkFB0GuIkAe3BxtMfRjVP/dJLBEm5TzvD3UbzLX fZbYcFNkt01dzMlP3E/FtlAbKR8FcHfO4fGbzqCs+fHXfQAqmSMEuhrG9B4P/dwG3mJoZ6 2g5kGKFskL4vC6B/Xe80DV+DUzk2tGS2Cffm2fZkIG7dUjRSzfSZ3xoUyW/y9Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1659295777; a=rsa-sha256; cv=none; b=miB5jPmEHBp7xhGcIKh9ypEBJ9RyvT3XdjdlVE1Kv5tpERj0IIJc1BMxIrZm1Ar670G2ym tPFzDrQ7wjMa2F6waWOlw5yibXV8hGWkcSuandyMNfYVktGr/MzSyYsU9lK4cStYUXMafx FPBbHuvPErxKy92FQTk+VuWxxP9Bcv/UmC1r9kiKTMXBiiHnDgAG8K8Vw2jbWXc5tztxPN jlxpmdHDhjs3EfhRmbhh1TCuaQNOtevQ1eZX+3vcvBCrejSGM498zXcqWoAlxnvAqaDNPf 68WfAT69x+R4CDDZBbM2rEvK8E+ASFCdcRrjdI+pgBoVs+oTNBbAjCoIE5GPsw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D265540 Bug ID: 265540 Summary: EADDRNOTAVAIL when leaving IPv6 multicast group and ipv6_mreq.ipv6mr_interface=3D0 Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: net@FreeBSD.org Reporter: dmgk@freebsd.org Created attachment 235586 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D235586&action= =3Dedit mcast.c When porting some Linux code, I noticed that when ipv6_mreq.ipv6mr_interfac= e=3D0, it is possible to join an IPv6 multicast group, but setsockopts() returns EADDRNOTAVAIL when leaving. Running attached mcast.c on 14.0-CURRENT: $ ./mcast mcast: addr: ff02::42 mcast: setsockopt: join ok mcast: setsockopt: IPV6_LEAVE_GROUP: Can't assign requested address I'm not sure whether this is a correct fix, but I think the lookup code in in6p_leave_group() is missing an in6_setscope() call: --- a/sys/netinet6/in6_mcast.c +++ b/sys/netinet6/in6_mcast.c @@ -2312,6 +2312,9 @@ in6p_leave_group(struct inpcb *inp, struct sockopt *s= opt) "ifp for group %s.", __func__, ip6_sprintf(ip6tbuf, &gsa->sin6.sin6_addr)); ifp =3D in6p_lookup_mcast_ifp(inp, &gsa->sin6); + if (ifp =3D=3D NULL) + return (EADDRNOTAVAIL); + (void)in6_setscope(&gsa->sin6.sin6_addr, ifp, NULL); } else { NET_EPOCH_ENTER(et); ifp =3D ifnet_byindex(ifindex); in6p_join_group() calls in6_setscope() in in6_mcast.c:1996, but the lookup = by im6o_match_group() in in6_mcast.c:2336 is performed using unscoped address. --=20 You are receiving this mail because: You are the assignee for the bug.=