raphdg / netifaces

I'm not the author of netifaces, I just added the project on github and I added a spec file to build the RPM package for the basic Amazon Linux AMI 2012.03
35 stars 10 forks source link

IPv6 link-local netmasks appear wrong on Windows 10 #7

Open robertsdotpm opened 2 years ago

robertsdotpm commented 2 years ago

Output from netifaces.ifaddresses("enp3s0")[netifaces.AF_INET6]:

[{'addr': 'some link local address here%enp3s0', 'netmask': 'ffff:ffff:ffff:ffff::/64'}]

The netmask for link-local in IPv6 is: 'fe80:0000:0000:0000:0000:0000:0000:0000.' It's specified to be /10 but in practice people use /64. I showed it using the uncompressed form of the address to avoid confusion. The last 64 bits are the host portion.

I'm also not sure the netmask returned for IPv6 'global addresses' makes sense either. With IPv4, you might write something like 0.0.0.0? But netifaces returns FF:FF:... setting all bits to one. It might make more sense to return something like ::/128 -- there is no network part for such global addresses.