-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Remove Ipv6Addr::is_unicast_link_local_strict
#85819
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
b466b2d
to
c1f0c15
Compare
@bors r+ |
📌 Commit c1f0c15 has been approved by |
☀️ Test successful - checks-actions |
let unicast_link_local: u16 = 1 << 4; | ||
let unicast_link_local_strict: u16 = 1 << 5; | ||
let unicast_site_local: u16 = 1 << 6; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This thing with gaps ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a bitset of which properties are true, one of the bits being unused shouldn't really matter. I think that is less invasive than renumbering all of them.
Removes the unstable method
Ipv6Addr::is_unicast_link_local_strict
and keeps the behaviour ofIpv6Addr::is_unicast_link_local
, see also #85604 where I have tried to summarize related discussion so far.My intent is for
is_unicast_link_local
,is_unicast_site_local
andis_unicast_global
to have the semantics of checking if an address has Link-Local, Site-Local or Global scope, see also #85696 which changes the behaviour ofis_unicast_global
and renames these methods tohas_unicast_XXX_scope
to reflect this.For checking Link-Local scope we currently have two methods:
is_unicast_link_local
andis_unicast_link_local_strict
. This is because of what appears to be conflicting definitions in IETF RFC 4291.From IETF RFC 4291 section 2.4: "Link-Local unicast" (
FE80::/10
)From IETF RFC 4291 section 2.5.6: "Link-Local IPv6 Unicast Addresses" (
FE80::/64
)With
is_unicast_link_local
checkingFE80::/10
andis_unicast_link_local_strict
checkingFE80::/64
.There is also IETF RFC 5156 section 2.4 which defines "Link-Scoped Unicast" as
FE80::/10
.It has been pointed out that implementations in other languages and the linux kernel all use
FE80::/10
(#76098 (comment), #76098 (comment)).Given all of this I believe the correct interpretation to be the following: All addresses in
FE80::/10
are defined as having Link-Local scope, however currently only the blockFE80::/64
has been allocated for "Link-Local IPv6 Unicast Addresses". This might change in the future however; more addresses inFE80::/10
could be allocated and those will have Link-Local scope. I therefore believe the current behaviour ofis_unicast_link_local
to be correct (if interpreting it to have the semantics ofhas_unicast_link_local_scope
) andis_unicast_link_local_strict
to be unnecessary, confusing and even a potential source of future bugs:Currently there is no real difference in checking
FE80::/10
orFE80::/64
, since any address in practice will beFE80::/64
. However if an application usesis_unicast_link_local_strict
to implement link-local (so non-global) behaviour, it will be incorrect in the future if addresses outside ofFE80::/64
are allocated.r? @joshtriplett as reviewer of all the related PRs