netifaces
netifaces copied to clipboard
missing routes in dict returned by gateways()
Demo below, it seems to completely miss the route on ens160u2u1
bash$ ip route
default via 10.30.1.1 dev ens33 proto dhcp src 10.30.1.143 metric 1024
10.30.1.0/24 dev ens33 proto kernel scope link src 10.30.1.143
10.30.1.1 dev ens33 proto dhcp scope link src 10.30.1.143 metric 1024
192.168.8.0/24 via 192.168.8.1 dev ens160u2u1
bash$ python
Python 3.9.1 (default, Dec 13 2020, 11:55:53)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import netifaces
>>> netifaces.gateways()
{'default': {2: ('10.30.1.1', 'ens33')}, 2: [('10.30.1.1', 'ens33', True)]}
>>> netifaces.version
'0.10.9'
>>>
bash$ uname -r
5.10.10-arch1-1
Seeing this as well, same host, different netifaces version.
With the system package, python3-netifaces 0.10.4-1ubuntu4:
[hloeung@host ~]$ python3
Python 3.8.5 (default, May 27 2021, 13:30:53)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import netifaces
>>> netifaces.gateways()['default']
{2: ('185.134.xxx.xxx', 'ens1d1'), 10: ('2a06:ee01:xxx.xxx', 'ens1d1')}
With the wheelhouse bundled version, netifaces-0.11.0.tar.gz:
[hloeung@host ~]$ /var/lib/juju/agents/unit-fw-xxx-0/charm/bin/charm-env python3
Python 3.8.5 (default, May 27 2021, 13:30:53)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import netifaces
>>> netifaces.gateways()['default']
{10: ('2a06:ee01:xxx.xxx', 'ens1d1')}