netlink: work around kernel cache refill problems

Sometimes cause the cache not to refill with all interfaces,
meaning NM sometimes got the wrong carrier state from the
kernel which prevented NM from taking over existing connections.
This commit is contained in:
Dan Williams
2010-01-14 14:15:18 -08:00
parent 534509b3c7
commit d41c35fbf8

View File

@@ -560,6 +560,19 @@ nm_netlink_monitor_get_flags_sync (NMNetlinkMonitor *self,
return FALSE;
}
/* HACK: Apparently to get it working we have to refill the cache twice;
* otherwise some kernels (or maybe libnl?) only send a few of the
* interfaces in the refill request.
*/
if (nl_cache_refill (priv->nlh, priv->nlh_link_cache)) {
g_set_error (error,
NM_NETLINK_MONITOR_ERROR,
NM_NETLINK_MONITOR_ERROR_LINK_CACHE_UPDATE,
_("error updating link cache: %s"),
nl_geterror ());
return FALSE;
}
/* Set up the filter */
filter = rtnl_link_alloc ();
if (!filter) {