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, he nl_addr_parse 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 reported a default
gateway anymore, and caused 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 committed Feb 1, 2024
1 parent 0fc22ff commit 18fc753
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/vdsm/network/netinfo/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ 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'] == 'none'
or route['destination'] == '0.0.0.0/0'
or route['destination'] == '::/0')
):
return True
return False
Expand Down Expand Up @@ -83,7 +85,8 @@ def get_gateway(
gateways = [
r
for r in routes
if r['destination'] == 'none'
if (r['destination'] == 'none' or r['destination'] == '0.0.0.0/0'
or r['destination'] == '::/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 18fc753

Please sign in to comment.