SamuelYvon / netifaces-2

netifaces reborn
https://pypi.org/project/netifaces2/
MIT License
21 stars 7 forks source link

The interface for obtaining the AF value of IPv6 is not consistent across different platforms. #24

Closed zoushucai closed 4 months ago

zoushucai commented 5 months ago

Get the local IPv6

eg: my win11:

netname = "***"
info = netifaces.ifaddresses(netname)[netifaces.AF_IRDA]  # success

# info = netifaces.ifaddresses(netname)[netifaces.AF_INET6]  # error

but ubuntu 22.04

netname = "***"
info = netifaces.ifaddresses(netname)[netifaces.AF_INET6]   # success
SamuelYvon commented 5 months ago

What version?

zoushucai commented 5 months ago

netifaces2==0.0.21

SamuelYvon commented 5 months ago

Re-reading your comment, you are observing that AF_INET6 (the integer value) differs from platform to platform, correct? IIRC (been a bit) the actual values are different but the code does not account for that (ie, AF_INET6 should always point to ipv6).

This should be simple enough to correct.

SamuelYvon commented 4 months ago

Will be fixed in #29