summaryrefslogtreecommitdiff
path: root/src/platform/nm-linux-platform.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/platform/nm-linux-platform.c')
-rw-r--r--src/platform/nm-linux-platform.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index c15a87941f..4fe8b9d870 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -78,6 +78,7 @@ struct libnl_vtable
int (*f_nl_has_capability) (int capability);
};
+static gboolean init_ip4_route (NMPlatformIP4Route *route, struct rtnl_route *rtnlroute);
typedef struct {
struct nl_sock *nlh;
@@ -461,6 +462,32 @@ get_kernel_object (struct nl_sock *sock, struct nl_object *needle)
object = nl_cache_search (cache, needle);
+ if (type == OBJECT_TYPE_IP4_ROUTE) {
+ NMPlatformIP4Route r_n, r_o;
+ struct nl_object *o;
+
+ if (!init_ip4_route (&r_n, (struct rtnl_route *) needle)) {
+ debug (">>> X - could not convert needle");
+ memset (&r_n, 0, sizeof (r_n));
+ } else
+ debug (">>> X - %s", nm_platform_ip4_route_to_string (&r_n));
+
+ if (!object)
+ debug (">>> X : not found");
+ else if (!init_ip4_route (&r_o, (struct rtnl_route *) object))
+ debug (">>> X : could not convert result");
+ else
+ debug (">>> X : %s", nm_platform_ip4_route_to_string (&r_o));
+
+ for (o = nl_cache_get_first (cache); o; o = nl_cache_get_next (o)) {
+ if (!init_ip4_route (&r_n, (struct rtnl_route *) o)) {
+ debug (">>> X = failed convert");
+ } else {
+ debug (">>> X = %s", nm_platform_ip4_route_to_string (&r_n));
+ }
+ }
+ }
+
nl_cache_free (cache);
if (object && (type == OBJECT_TYPE_IP4_ADDRESS || type == OBJECT_TYPE_IP6_ADDRESS))
@@ -1328,14 +1355,14 @@ init_ip4_route (NMPlatformIP4Route *route, struct rtnl_route *rtnlroute)
/* Workaround on previous workaround for libnl default route prefixlen bug. */
if (nl_addr_get_len (dst)) {
if (nl_addr_get_len (dst) != sizeof (route->network)) {
- g_return_val_if_reached (FALSE);
+ //g_return_val_if_reached (FALSE);
return FALSE;
}
memcpy (&route->network, nl_addr_get_binary_addr (dst), sizeof (route->network));
}
if (gw) {
if (nl_addr_get_len (gw) != sizeof (route->network)) {
- g_return_val_if_reached (FALSE);
+ //g_return_val_if_reached (FALSE);
return FALSE;
}
memcpy (&route->gateway, nl_addr_get_binary_addr (gw), sizeof (route->gateway));
@@ -1706,6 +1733,7 @@ refresh_object (NMPlatform *platform, struct nl_object *object, gboolean removed
cache = choose_cache (platform, object);
cached_object = nm_nl_cache_search (cache, object);
+ debug (">>>1");
kernel_object = get_kernel_object (priv->nlh, object);
if (removed) {
@@ -1927,6 +1955,7 @@ event_notification (struct nl_msg *msg, gpointer user_data)
cache = choose_cache_by_type (platform, type);
cached_object = nm_nl_cache_search (cache, object);
+ debug (">>>2: %d", (int) type);
kernel_object = get_kernel_object (priv->nlh, object);
hack_empty_master_iff_lower_up (platform, kernel_object);
@@ -3643,7 +3672,7 @@ _route_match (struct rtnl_route *rtnlroute, int family, int ifindex)
if (rtnl_route_get_type (rtnlroute) != RTN_UNICAST ||
rtnl_route_get_table (rtnlroute) != RT_TABLE_MAIN ||
- rtnl_route_get_protocol (rtnlroute) == RTPROT_KERNEL ||
+ //rtnl_route_get_protocol (rtnlroute) == RTPROT_KERNEL ||
rtnl_route_get_family (rtnlroute) != family ||
rtnl_route_get_nnexthops (rtnlroute) != 1 ||
rtnl_route_get_flags (rtnlroute) & RTM_F_CLONED)