Closed B17C0D3 closed 6 months ago
It should be working. What's your platform?
raspberry os
$ uname -a
Linux cm4 6.1.34-v8+ #1657 SMP PREEMPT Fri Jun 16 12:36:29 BST 2023 aarch64 GNU/Linux
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
Ok; I've spotted why IPv6 gateways are not displayed. Can you confirm whether ifaddresses(ifname)
returns ipv6 addresses? It works fine here -- might be a platform issue.
I'll fix this soon.
yes ifaddresses(ifname) works fine
If you would be so kind, this run https://github.com/SamuelYvon/netifaces-2/actions/runs/5364836999 should provide wheels with the fix.
Here is what I changed:
/usr/sbin/ip
if available to get routes, including IPv6. This means if you don't have ip
on your system, this won't work. The real solution is to get the routes from the kernel, but I don't have time right now to go mess with the rust layer.netifaces.gateways(old_api=True)
Please let me now if this works as expected. I do not have an Ipv6 gateway and am too lazy to make a fake network 😉 This is a straightforward enough change however. If this works, I'll push to pypi.
my test provides only the ipv4 gateway. the old netifaces also returned the ipv6 gateway
also instead of
<InterfaceType.AF_INET: 2>
should be a simple2
like in the return ofi clearly have an ipv6 default route