summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2015-01-15 11:13:20 -0600
committerDan Williams <dcbw@redhat.com>2015-01-15 11:13:20 -0600
commitdd20407c4e73d730be093d56e8090844e4a1f1d4 (patch)
tree83373680610c38b43981e8c443363cb5b809322d
parentd2871089a879fd33efec8ca7de2a1850f76e3c4f (diff)
downloadNetworkManager-dd20407c4e73d730be093d56e8090844e4a1f1d4.tar.gz
Revert "platform: avoid storing unknown netlink object types (bgo #742928)"
This reverts commit 6c1a6d2d5f8c102a7b43e167791954ba36dff31e. Mistaken push; it'll get committed, just needs a slight fixup.
-rw-r--r--src/platform/nm-linux-platform.c46
1 files changed, 1 insertions, 45 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 675a6e0573..d694c286b3 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -1725,15 +1725,9 @@ refresh_object (NMPlatform *platform, struct nl_object *object, gboolean removed
announce_object (platform, cached_object, NM_PLATFORM_SIGNAL_REMOVED, reason);
}
} else {
- ObjectType type;
-
if (!kernel_object)
return FALSE;
- /* Unsupported object types should never have reached the caches */
- type = object_type_from_nl_object (kernel_object);
- g_assert (type != OBJECT_TYPE_UNKNOWN);
-
hack_empty_master_iff_lower_up (platform, kernel_object);
if (cached_object)
@@ -1747,7 +1741,7 @@ refresh_object (NMPlatform *platform, struct nl_object *object, gboolean removed
announce_object (platform, kernel_object, cached_object ? NM_PLATFORM_SIGNAL_CHANGED : NM_PLATFORM_SIGNAL_ADDED, reason);
/* Refresh the master device (even on enslave/release) */
- if (type == OBJECT_TYPE_LINK) {
+ if (object_type_from_nl_object (kernel_object) == OBJECT_TYPE_LINK) {
int kernel_master = rtnl_link_get_master ((struct rtnl_link *) kernel_object);
int cached_master = cached_object ? rtnl_link_get_master ((struct rtnl_link *) cached_object) : 0;
struct nl_object *master_object;
@@ -2009,11 +2003,6 @@ event_notification (struct nl_msg *msg, gpointer user_data)
*/
if (!kernel_object)
return NL_OK;
-
- /* Ignore unsupported object types (e.g. AF_PHONET family addresses) */
- if (type == OBJECT_TYPE_UNKNOWN)
- return NL_OK;
-
/* Handle external addition */
if (!cached_object) {
nle = nl_cache_add (cache, kernel_object);
@@ -4104,34 +4093,6 @@ cache_announce_changes (NMPlatform *platform, struct nl_cache *new, struct nl_ca
nl_cache_free (old);
}
-/* The cache should always avoid containing objects not handled by NM, like
- * e.g. addresses of the AF_PHONET family. */
-static void
-cache_remove_unknown (NMPlatform *platform, struct nl_cache *cache)
-{
- NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform);
- GPtrArray *objects_to_remove = NULL;
- struct nl_object *object;
-
- for (object = nl_cache_get_first (priv->address_cache); object; object = nl_cache_get_next (object)) {
- if (object_type_from_nl_object (object) == OBJECT_TYPE_UNKNOWN) {
- if (!objects_to_remove)
- objects_to_remove = g_ptr_array_new_with_free_func ((GDestroyNotify) nl_object_put);
- nl_object_get (object);
- g_ptr_array_add (objects_to_remove, object);
- }
- }
-
- if (objects_to_remove) {
- guint i;
-
- for (i = 0; i < objects_to_remove->len; i++)
- nl_cache_remove (g_ptr_array_index (objects_to_remove, i));
-
- g_ptr_array_free (objects_to_remove, TRUE);
- }
-}
-
/* Creates and populates the netlink object caches. Called upon platform init and
* when we run out of sync (out of buffer space, netlink congestion control). In case
* the caches already exist, it finds changed, added and removed objects, announces
@@ -4153,11 +4114,6 @@ cache_repopulate_all (NMPlatform *platform)
rtnl_route_alloc_cache (priv->nlh, AF_UNSPEC, 0, &priv->route_cache);
g_assert (priv->link_cache && priv->address_cache && priv->route_cache);
- /* Remove all unknown objects from the caches */
- cache_remove_unknown (platform, priv->link_cache);
- cache_remove_unknown (platform, priv->address_cache);
- cache_remove_unknown (platform, priv->route_cache);
-
for (object = nl_cache_get_first (priv->address_cache); object; object = nl_cache_get_next (object)) {
_rtnl_addr_hack_lifetimes_rel_to_abs ((struct rtnl_addr *) object);
}