blob: 05c2dca00e5d27899b1d92a8d3d22b19f7556167 [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001From cbcb848e6d4f4e8c4aa11c80f1f3dbb7fb2d397e Mon Sep 17 00:00:00 2001
2From: Beniamino Galvani <bgalvani@redhat.com>
3Date: Mon, 4 Jan 2016 14:22:01 +0100
4Subject: [PATCH 3/7] device: update @ip_iface only if IP interface exists
5
6If @ip_ifindex is zero, the IP interface has disappeared and
7there's no point in updating @ip_iface.
8
9Actually, unconditionally updating @ip_iface is dangerous because it
10breaks the assumption used by other functions (as
11nm_device_get_ip_ifindex()) that a non-NULL @ip_iface implies a valid
12@ip_ifindex. This was causing the scary failure:
13
14 devices/nm-device.c:666:get_ip_iface_identifier: assertion failed: (ifindex)
15
16https://bugzilla.redhat.com/show_bug.cgi?id=1268617
17(cherry picked from commit ed536998f9530698ff3082fc5587dbeb7d3a594f)
18---
19 src/devices/nm-device.c | 7 ++++---
20 1 file changed, 4 insertions(+), 3 deletions(-)
21
22diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
23index bb39ca5..4413e92 100644
24--- a/src/devices/nm-device.c
25+++ b/src/devices/nm-device.c
26@@ -1526,12 +1526,13 @@ device_ip_link_changed (NMDevice *self)
27 {
28 NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
29 const NMPlatformLink *pllink;
30- int ip_ifindex;
31
32 priv->device_ip_link_changed_id = 0;
33
34- ip_ifindex = nm_device_get_ip_ifindex (self);
35- pllink = nm_platform_link_get (NM_PLATFORM_GET, ip_ifindex);
36+ if (!priv->ip_ifindex)
37+ return G_SOURCE_REMOVE;
38+
39+ pllink = nm_platform_link_get (NM_PLATFORM_GET, priv->ip_ifindex);
40 if (!pllink)
41 return G_SOURCE_REMOVE;
42
43--
442.5.0
45