summaryrefslogtreecommitdiff
path: root/src/devices/wwan/nm-device-modem.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-01-10 16:33:13 +0100
committerThomas Haller <thaller@redhat.com>2018-02-21 20:28:46 +0100
commitab4578302d6968fe420db0951c5291c65c631e51 (patch)
treeaa73c7257477d86f8e327abfed307e800fd3aceb /src/devices/wwan/nm-device-modem.c
parent79980536b98b6319f0c3bd9598aada51768c1a3e (diff)
downloadNetworkManager-ab4578302d6968fe420db0951c5291c65c631e51.tar.gz
device: refactor nm_device_set_ip_ifindex() and set_ip_iface()
- don't even bother to look into the platform cache, but use if_indextoname() / if_nametoindex(). In most cases, we obtained the ifindex/ifname not from the platform cache in the first place. Hence, there is a race, where the interface might not exist. However, try to process events of the platform cache, hoping that the cache contains an interface for the given ifindex/ifname. - let set_ip_ifindex() and set_ip_iface() both return a boolean value to indicate whether a ip-interface is set or not. That is, whether we have a positive ip_ifindex. That seems more interesting information, then to return whether anything changed. - as before, set_ip_ifindex() can only clear an ifindex/ifname, or error out without doing anything. That is different from set_ip_iface(), which will also set an ifname if no ifindex can be resolved. That is curreently ugly, because then ip-ifindex and ip-iface don't agree. That shall be improved in the future by: - trying to set an interface that cannot be resolved shall lead to a disconnect in any case. - we shall make less use of the ip-iface and rely more on the ifindex.
Diffstat (limited to 'src/devices/wwan/nm-device-modem.c')
-rw-r--r--src/devices/wwan/nm-device-modem.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/devices/wwan/nm-device-modem.c b/src/devices/wwan/nm-device-modem.c
index ccf6e17da2..cec9e5327b 100644
--- a/src/devices/wwan/nm-device-modem.c
+++ b/src/devices/wwan/nm-device-modem.c
@@ -263,17 +263,17 @@ static void
data_port_changed_cb (NMModem *modem, GParamSpec *pspec, gpointer user_data)
{
NMDevice *self = NM_DEVICE (user_data);
- gboolean changed;
+ gboolean has_ifindex;
/* We set the IP iface in the device as soon as we know it, so that we
* properly ifup it if needed */
- changed = nm_device_set_ip_iface (self, nm_modem_get_data_port (modem));
+ has_ifindex = nm_device_set_ip_iface (self, nm_modem_get_data_port (modem));
/* Disable IPv6 immediately on the interface since NM handles IPv6
* internally, and leaving it enabled could allow the kernel's IPv6
* RA handling code to run before NM is ready.
*/
- if (changed)
+ if (has_ifindex)
nm_device_ipv6_sysctl_set (self, "disable_ipv6", "1");
}