Commit 5c54b7a3 authored by Thomas Haller's avatar Thomas Haller

route-manager: normalize host part of tracked routes in _vx_route_sync()

The input list of routes is allowed to contain non-normalized routes,
that is, routes which host part is non-zero. Such routes are rejected
by kernel, but NM should transparently allow them (by normalizing
the host part).

The ID comparison function route_id_cmp() already properly ignored
the (possibly non-zero) host part. However, in the internal list we
also should make sure not to track such routes. We achive that by
normalizing the host part to zero.

Note that below we check whether the tracked route is idential to
the route configured at platform. If we don't normalize the host part,
the comparison will always indicate that the route is not yet
configured, and thus we will re-sync the route every time.
parent 034b7fb5
......@@ -536,6 +536,8 @@ _vx_route_sync (const VTableIP *vtable, NMRouteManager *self, int ifindex, const
memcpy (cur_ipx_route, cur_known_route, vtable->vt->sizeof_route);
cur_ipx_route->rx.ifindex = ifindex;
cur_ipx_route->rx.metric = vtable->vt->metric_normalize (cur_ipx_route->rx.metric);
nm_utils_ipx_address_clear_host_address (vtable->vt->addr_family, cur_ipx_route->rx.network_ptr,
cur_ipx_route->rx.network_ptr, cur_ipx_route->rx.plen);
ipx_routes_changed = TRUE;
_LOGt (vtable->vt->addr_family, "%3d: STATE: update #%u - %s", ifindex, i_ipx_routes,
vtable->vt->route_to_string (cur_ipx_route, NULL, 0));
......@@ -631,6 +633,8 @@ _vx_route_sync (const VTableIP *vtable, NMRouteManager *self, int ifindex, const
ipx_route = VTABLE_ROUTE_INDEX (vtable, ipx_routes->entries, ipx_routes->entries->len - 1);
ipx_route->rx.ifindex = ifindex;
ipx_route->rx.metric = vtable->vt->metric_normalize (ipx_route->rx.metric);
nm_utils_ipx_address_clear_host_address (vtable->vt->addr_family, ipx_route->rx.network_ptr,
ipx_route->rx.network_ptr, ipx_route->rx.plen);
g_array_index (ipx_routes->effective_metrics_reverse, gint64, j++) = -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment