summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-11-10 09:09:27 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2017-11-10 15:07:57 +0100
commit52f0800987328f634e602a685beefe7d9fa176bf (patch)
tree703283c386d362d0f7a753c9486f0f02488d4695
parent481c15e287ce599dc3d5fb76bca0e36d932aaab4 (diff)
downloadNetworkManager-52f0800987328f634e602a685beefe7d9fa176bf.tar.gz
ofono: fix creating IP config with proper ifindex of Interface
This was broken with the routing-rework. We need to determine the ifindex on which the configuration applies.
-rw-r--r--src/devices/wwan/nm-modem-ofono.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/src/devices/wwan/nm-modem-ofono.c b/src/devices/wwan/nm-modem-ofono.c
index 3a1e9d6898..25fe868b10 100644
--- a/src/devices/wwan/nm-modem-ofono.c
+++ b/src/devices/wwan/nm-modem-ofono.c
@@ -836,6 +836,7 @@ context_property_changed (GDBusProxy *proxy,
guint32 address_network, gateway_network;
guint32 ip4_route_table, ip4_route_metric;
guint prefix = 0;
+ int ifindex;
_LOGD ("PropertyChanged: %s", property);
@@ -865,6 +866,12 @@ context_property_changed (GDBusProxy *proxy,
goto out;
}
+ ifindex = nm_platform_link_get_ifindex (NM_PLATFORM_GET, interface);
+ if (ifindex <= 0) {
+ _LOGW ("Interface \"%s\" not found", interface);
+ goto out;
+ }
+
_LOGD ("Interface: %s", interface);
g_object_set (self,
NM_MODEM_DATA_PORT, interface,
@@ -876,27 +883,8 @@ context_property_changed (GDBusProxy *proxy,
memset (&addr, 0, sizeof (addr));
- /*
- * TODO:
- *
- * NM 1.2 changed the NMIP4Config constructor to take an ifindex
- * ( vs. void pre 1.2 ), to tie config instance to a specific
- * platform interface.
- *
- * This doesn't work for ofono, as the devices are created
- * dynamically ( eg. ril_0, ril_1 ) in NMModemManager. The
- * device created doesn't really map directly to a platform
- * link. The closest would be one of the devices owned by
- * rild ( eg. ccmin0 ), which is passed to us above as
- * 'Interface'.
- *
- * This needs discussion with upstream.
- *
- * FIXME: it is no longer allowed to omit the ifindex for NMIP4Config instances.
- * This is broken.
- */
priv->ip4_config = nm_ip4_config_new (nm_platform_get_multi_idx (NM_PLATFORM_GET),
- 0);
+ ifindex);
/* TODO: simply if/else error logic! */