Skip to content

Commit

Permalink
Fix default route with libnl3.8+
Browse files Browse the repository at this point in the history
Since libnl3.8, the nl_addr_parse function does not return 'none' anymore for
'default', but it returns a 0.0.0.0/0 addr.
thom311/libnl@0c0aee8

But since we depend on that value in vdsm, it never reports a default
gateway anymore, causing networks to be out of sync.

So next to 'none' we also check for '0.0.0.0/0' or '::/0'.

Signed-off-by: Jean-Louis Dupond <jean-louis@dupond.be>
  • Loading branch information
dupondje authored and almusil committed Feb 1, 2024
1 parent 0fc22ff commit 49eaf70
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/vdsm/network/netinfo/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def is_default_route(gateway, routes):
and route['family'] == 'inet'
and route['scope'] == 'global'
and route['gateway'] == gateway
and route['destination'] == 'none'
and route['destination'] in ('none', '0.0.0.0/0', '::/0')
):
return True
return False
Expand Down Expand Up @@ -83,7 +83,7 @@ def get_gateway(
gateways = [
r
for r in routes
if r['destination'] == 'none'
if r['destination'] in ('none', '0.0.0.0/0', '::/0')
and (r.get('table') == table or table == RtKnownTables.RT_TABLE_UNSPEC)
and r['scope'] == 'global'
and r['family'] == ('inet6' if family == 6 else 'inet')
Expand Down

0 comments on commit 49eaf70

Please sign in to comment.