Commit 70ab174e authored by Thomas Haller's avatar Thomas Haller

default-route-manager: simplify _platform_changed_cb() handling

There is only one caller of _platform_ipx_route_changed_cb(). Inline it,
it is simpler.
parent 0b3ba994
......@@ -1331,33 +1331,6 @@ _resync_idle_reschedule (NMDefaultRouteManager *self)
}
}
static void
_platform_ipx_route_changed_cb (const VTableIP *vtable,
NMDefaultRouteManager *self,
const NMPlatformIPRoute *route)
{
NMDefaultRouteManagerPrivate *priv;
if (route && !NM_PLATFORM_IP_ROUTE_IS_DEFAULT (route)) {
/* we only care about address changes or changes of default route. */
return;
}
priv = NM_DEFAULT_ROUTE_MANAGER_GET_PRIVATE (self);
if (priv->resync.guard) {
/* callbacks while executing _resync_all() are ignored. */
return;
}
if (vtable->vt->is_ip4)
priv->resync.has_v4_changes = TRUE;
else
priv->resync.has_v6_changes = TRUE;
_resync_idle_reschedule (self);
}
static void
_platform_changed_cb (NMPlatform *platform,
int obj_type_i,
......@@ -1366,24 +1339,44 @@ _platform_changed_cb (NMPlatform *platform,
int change_type_i,
NMDefaultRouteManager *self)
{
NMDefaultRouteManagerPrivate *priv;
const NMPObjectType obj_type = obj_type_i;
const VTableIP *vtable;
switch (obj_type) {
case NMP_OBJECT_TYPE_IP4_ADDRESS:
_platform_ipx_route_changed_cb (&vtable_ip4, self, NULL);
vtable = &vtable_ip4;
break;
case NMP_OBJECT_TYPE_IP6_ADDRESS:
_platform_ipx_route_changed_cb (&vtable_ip6, self, NULL);
vtable = &vtable_ip6;
break;
case NMP_OBJECT_TYPE_IP4_ROUTE:
_platform_ipx_route_changed_cb (&vtable_ip4, self, (const NMPlatformIPRoute *) platform_object);
if (!NM_PLATFORM_IP_ROUTE_IS_DEFAULT (platform_object))
return;
vtable = &vtable_ip4;
break;
case NMP_OBJECT_TYPE_IP6_ROUTE:
_platform_ipx_route_changed_cb (&vtable_ip6, self, (const NMPlatformIPRoute *) platform_object);
if (!NM_PLATFORM_IP_ROUTE_IS_DEFAULT (platform_object))
return;
vtable = &vtable_ip6;
break;
default:
g_return_if_reached ();
}
priv = NM_DEFAULT_ROUTE_MANAGER_GET_PRIVATE (self);
if (priv->resync.guard) {
/* callbacks while executing _resync_all() are ignored. */
return;
}
if (vtable->vt->is_ip4)
priv->resync.has_v4_changes = TRUE;
else
priv->resync.has_v6_changes = TRUE;
_resync_idle_reschedule (self);
}
/*****************************************************************************/
......
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