You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 25, 2023. It is now read-only.
net.IP.IsLinkLocalUnicast() (since golang/go@91ba0ab in go 1.5beta2 ) checks the first byte equals 0xfe, and the second byte masked with 0b1100_0000 == 0b1000_0000
For the IPv6 address feb0::0
I believe netaddr.IP is in error, and net.IP may be correct. It's possible both are in error, but I don't think so.
RFC4291 section 2.4
netaddr
netaddr.IP.IsLinkLocalUnicast()
only checks the first 16 bits equal 0xfeb0, it doesn't mask.netaddr/netaddr.go
Line 548 in c0eff85
net
net.IP.IsLinkLocalUnicast()
(since golang/go@91ba0ab in go 1.5beta2 ) checks the first byte equals0xfe
, and the second byte masked with0b1100_0000
==0b1000_0000
-- https://github.com/golang/go/blob/f22ec51debeddc0903096e66bfaf641568bede3b/src/net/ip.go#L179
Analysis
Going purely from RFC4291 section 2.4 I would expect the correct test to be
where
0xffc0 == 0b1111_1111_1100_0000
is the netmask0xfe80 == 0b1111_1110_1000_0000
is the prefixThe text was updated successfully, but these errors were encountered: