SamuelYvon / netifaces-2

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

Is ipv6 not implemented? #17

Closed B17C0D3 closed 6 months ago

B17C0D3 commented 1 year ago

my test provides only the ipv4 gateway. the old netifaces also returned the ipv6 gateway

import netifaces
print(netifaces.gateways())
{<InterfaceType.AF_INET: 2>: [('192.168.10.1', 'eth0', True)]}

also instead of <InterfaceType.AF_INET: 2> should be a simple 2 like in the return of

print(netifaces.ifaddresses('eth0'))
{2: [{'addr': '192.168.10.4', 'broadcast': '192.168.10.255', 'mask': '255.255.255.0'}],... and so on

i clearly have an ipv6 default route

ip -6 route
default via fe80::1eed:6fff:fe2d:91b4 dev eth0 proto ra metric 202 mtu 1492 pref medium
SamuelYvon commented 1 year ago

It should be working. What's your platform?

B17C0D3 commented 1 year ago
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
SamuelYvon commented 1 year ago

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.

B17C0D3 commented 1 year ago

yes ifaddresses(ifname) works fine

SamuelYvon commented 1 year ago

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:

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.