From nobody Thu Apr 24 00:52:24 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 4ZjcrT1BPLz5t9RR; Thu, 24 Apr 2025 00:52:25 +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 4ZjcrS5r31z43v3; Thu, 24 Apr 2025 00:52:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1745455944; 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=1+dV4dqM3Iweoi4S/qaMK6IeJRhk9iK7XXb9KQtwkHA=; b=nj7/7kKtXPhI5Q0JKRgVHoQpotP4Zc9ToBtwAx4+RqX+/OBleWVDWiJ3qg1QclVinDvnI6 j3l2VZ+rL2wUdSL+pWf8SbuRNMt21yMyghMb/weqKSiAOGZmCMIcuxZmFcsYCph1T53dGZ ZduMrX1DnK5P/aubTZZOEB3XAWoHHKHUV5F+FOL2TNOVmY6OCL+L0zbGQ1LVUaBL70Y1oC 5lJK/FNEskc/nc21A+XEc+vNKj0mrctgD5rgoRVjq3Jxw4MbcM4ekhGXzvIBDSR6Imp/e5 Ai1jfIZUP0aVZvMYnqSIGo1MbpB4MMTp/HHR8Bgm94k1Hpp4qBK2eKyf+iyXUw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1745455944; a=rsa-sha256; cv=none; b=G8DAJH+d0nKs8ZSy9+BsR3tOe86KoAdWAvjhX10Ueafcg+hzGwT7yewVZPJ2Oy0EFlTKqx euQzEtrJiGqv3nCIruAH7W/knKC5XV8j3xCtuMojlN79sbwqcgouAKtqW+Kkdnx+8mu7i5 oCSozesEEV0yMjucY0PEKXw256djWRG4kYsiyEy7fD0+Ykbl1XNmoLiRwbmKyKkCIAWMZE 8YFyJk2xqJHll7oFzS0Mq/6+eD9kINI7Ssq2pg7KlHd6plsLRnSs9vJTqY2Cu42c/lJss3 jf/KsKhBBWjC8c4xq+TfOIQJh+mFwJTGSt52hv0zzyrBu/XvHU7EjsRbNaJ0NA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1745455944; 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=1+dV4dqM3Iweoi4S/qaMK6IeJRhk9iK7XXb9KQtwkHA=; b=mWapMBiT08222aea9vgJgIWbneSJ0bNxC2kCUq6NIXJerXcwaDFrfvdLcvc1qO3LyOzEnz P1y4pysX4PUvujBagpUohVOj+oWwRmJkPX4GBUv1yOBqVL9Xt4WOuC0UdHlgpCdf7Ah2St 6Whe2tSJaKwvd+FxqBLv64RJUhjKPRtmT1vSD6Evj5HzdkaK0tk1zTJ4B8GTzunavRXk+Q sgtL0GqTVfH0XaDd3VRCbAOnv2AEMnw0N5JYKw7f2LbjL05l5Q49A+hxJO5AbrKGRBWFfl xGg2oKJIrIk4wAcPcQLuI/0HaALcfCBzhdc8CAV+SZod1zQDwZrq3WprB7s3gg== 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 4ZjcrS5BcvzCFl; Thu, 24 Apr 2025 00:52:24 +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 53O0qO3Z038315; Thu, 24 Apr 2025 00:52:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 53O0qO0G038312; Thu, 24 Apr 2025 00:52:24 GMT (envelope-from git) Date: Thu, 24 Apr 2025 00:52:24 GMT Message-Id: <202504240052.53O0qO0G038312@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lexi Winter Subject: git: ca4b046105f6 - main - netinet6: allow binding to anycast addresses 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: ivy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ca4b046105f640ebcbdec7cb74a9eecb963264a6 Auto-Submitted: auto-generated The branch main has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=ca4b046105f640ebcbdec7cb74a9eecb963264a6 commit ca4b046105f640ebcbdec7cb74a9eecb963264a6 Author: Lexi Winter AuthorDate: 2025-04-24 00:48:39 +0000 Commit: Lexi Winter CommitDate: 2025-04-24 00:50:38 +0000 netinet6: allow binding to anycast addresses the restriction on sending packets from anycast source addresses was removed in RFC4291, so there's no reason to forbid binding to such addresses. this allows anycast services (e.g., DNS) to actually use anycast addresses, which was previously impossible. RFC4291 also removes the restriction that only routers may configure anycast addresses; this was never enforced in code but was documented in ifconfig.8. update ifconfig.8 to document both changes. PR: 285545 Reviewed by: des, adrian Approved by: des (mentor) Differential Revision: https://reviews.freebsd.org/D49905 --- sbin/ifconfig/ifconfig.8 | 21 +++++++++++++++------ sys/netinet6/in6_pcb.c | 9 ++++----- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8 index dfea59dfd229..e3f094a336fb 100644 --- a/sbin/ifconfig/ifconfig.8 +++ b/sbin/ifconfig/ifconfig.8 @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd June 6, 2024 +.Dd April 24, 2025 .Dt IFCONFIG 8 .Os .Sh NAME @@ -448,11 +448,10 @@ of specifying the host portion, removing all NS addresses will allow you to respecify the host portion. .It Cm anycast (Inet6 only.) -Specify that the address configured is an anycast address. -Based on the current specification, -only routers may configure anycast addresses. -Anycast address will not be used as source address of any of outgoing -IPv6 packets. +Specify that the address configured is an anycast address, +as described in RFC 4291 section 2.6. +Anycast addresses will not be used as source address of any outgoing +IPv6 packets unless an application explicitly binds to the address. .It Cm arp Enable the use of the Address Resolution Protocol .Pq Xr arp 4 @@ -3326,6 +3325,16 @@ tried to alter an interface's configuration. .Xr rc 8 , .Xr routed 8 , .Xr sysctl 8 +.Rs +.%R RFC 3484 +.%D February 2003 +.%T "Default Address Selection for Internet Protocol version 6 (IPv6)" +.Re +.Rs +.%R RFC 4291 +.%D February 2006 +.%T "IP Version 6 Addressing Architecture" +.Re .Sh HISTORY The .Nm diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 65b7ead1e365..dfda0c60c0ba 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -214,14 +214,13 @@ in6_pcbbind_avail(struct inpcb *inp, const struct sockaddr_in6 *sin6, int fib, } /* - * XXX: bind to an anycast address might accidentally - * cause sending a packet with anycast source address. - * We should allow to bind to a deprecated address, since - * the application dares to use it. + * We used to prohibit binding to an anycast address here, + * based on RFC3513, but that restriction was removed in + * RFC4291. */ if (ifa != NULL && ((struct in6_ifaddr *)ifa)->ia6_flags & - (IN6_IFF_ANYCAST | IN6_IFF_NOTREADY | IN6_IFF_DETACHED)) { + (IN6_IFF_NOTREADY | IN6_IFF_DETACHED)) { NET_EPOCH_EXIT(et); return (EADDRNOTAVAIL); }