Skip to content

Commit ca4b046

Browse files
Lexi WinterLexi Winter
authored andcommitted
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
1 parent f2605f6 commit ca4b046

2 files changed

Lines changed: 19 additions & 11 deletions

File tree

sbin/ifconfig/ifconfig.8

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2929
.\" SUCH DAMAGE.
3030
.\"
31-
.Dd June 6, 2024
31+
.Dd April 24, 2025
3232
.Dt IFCONFIG 8
3333
.Os
3434
.Sh NAME
@@ -448,11 +448,10 @@ of specifying the host portion, removing all NS addresses will
448448
allow you to respecify the host portion.
449449
.It Cm anycast
450450
(Inet6 only.)
451-
Specify that the address configured is an anycast address.
452-
Based on the current specification,
453-
only routers may configure anycast addresses.
454-
Anycast address will not be used as source address of any of outgoing
455-
IPv6 packets.
451+
Specify that the address configured is an anycast address,
452+
as described in RFC 4291 section 2.6.
453+
Anycast addresses will not be used as source address of any outgoing
454+
IPv6 packets unless an application explicitly binds to the address.
456455
.It Cm arp
457456
Enable the use of the Address Resolution Protocol
458457
.Pq Xr arp 4
@@ -3326,6 +3325,16 @@ tried to alter an interface's configuration.
33263325
.Xr rc 8 ,
33273326
.Xr routed 8 ,
33283327
.Xr sysctl 8
3328+
.Rs
3329+
.%R RFC 3484
3330+
.%D February 2003
3331+
.%T "Default Address Selection for Internet Protocol version 6 (IPv6)"
3332+
.Re
3333+
.Rs
3334+
.%R RFC 4291
3335+
.%D February 2006
3336+
.%T "IP Version 6 Addressing Architecture"
3337+
.Re
33293338
.Sh HISTORY
33303339
The
33313340
.Nm

sys/netinet6/in6_pcb.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,14 +214,13 @@ in6_pcbbind_avail(struct inpcb *inp, const struct sockaddr_in6 *sin6, int fib,
214214
}
215215

216216
/*
217-
* XXX: bind to an anycast address might accidentally
218-
* cause sending a packet with anycast source address.
219-
* We should allow to bind to a deprecated address, since
220-
* the application dares to use it.
217+
* We used to prohibit binding to an anycast address here,
218+
* based on RFC3513, but that restriction was removed in
219+
* RFC4291.
221220
*/
222221
if (ifa != NULL &&
223222
((struct in6_ifaddr *)ifa)->ia6_flags &
224-
(IN6_IFF_ANYCAST | IN6_IFF_NOTREADY | IN6_IFF_DETACHED)) {
223+
(IN6_IFF_NOTREADY | IN6_IFF_DETACHED)) {
225224
NET_EPOCH_EXIT(et);
226225
return (EADDRNOTAVAIL);
227226
}

0 commit comments

Comments
 (0)