route-manager: fix return value of _vx_route_sync()

When the call to route_add() fails and the route is SOURCE_USER the
function must return an error.

Fixes: 62c652c352
(cherry picked from commit 7364d7f8f2)
This commit is contained in:
Beniamino Galvani 2015-06-26 13:34:06 +02:00
parent b30e7c9c61
commit 1ee9ff2cd6

View file

@ -558,16 +558,18 @@ _vx_route_sync (const VTableIP *vtable, NMRouteManager *self, int ifindex, const
if ( !cur_plat_route
|| route_id_cmp_result != 0
|| !_route_equals_ignoring_ifindex (vtable, cur_plat_route, cur_ipx_route)) {
gboolean s;
s = vtable->vt->route_add (NM_PLATFORM_GET, ifindex, cur_ipx_route, 0);
if (!s && cur_ipx_route->rx.source < NM_IP_CONFIG_SOURCE_USER) {
_LOGD (vtable->vt->addr_family, "ignore error adding IPv%c route to kernel: %s",
vtable->vt->is_ip4 ? '4' : '6',
vtable->vt->route_to_string (cur_ipx_route));
/* Remember that there was a failure, but for now continue trying to sync the
* remaining routes. */
success = FALSE;
if (!vtable->vt->route_add (NM_PLATFORM_GET, ifindex, cur_ipx_route, 0)) {
if (cur_ipx_route->rx.source < NM_IP_CONFIG_SOURCE_USER) {
_LOGD (vtable->vt->addr_family,
"ignore error adding IPv%c route to kernel: %s",
vtable->vt->is_ip4 ? '4' : '6',
vtable->vt->route_to_string (cur_ipx_route));
} else {
/* Remember that there was a failure, but for now continue trying
* to sync the remaining routes. */
success = FALSE;
}
}
}
}