diff options
author | Thomas Haller <thaller@redhat.com> | 2016-11-08 09:48:27 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2016-11-09 17:45:39 +0100 |
commit | 602247e8e304e936b4e1a5e6e67533e3b9f26abb (patch) | |
tree | f254533a3a58e5241e5e46a7d1bcc616e262ad7c /src/devices/nm-device-ip-tunnel.c | |
parent | a6416cbd134b7f38408e659bfb346ca8f2af5a24 (diff) | |
download | NetworkManager-602247e8e304e936b4e1a5e6e67533e3b9f26abb.tar.gz |
ip-tunnel: avoid crash on missing NMPlatformLnkIp6Tnl lnk part
You cannot assume that we are always able to lookup a corresponding
lnk object. In fact, there is no guarantee that link->ifindex still
exists in the platform cache at all.
Diffstat (limited to 'src/devices/nm-device-ip-tunnel.c')
-rw-r--r-- | src/devices/nm-device-ip-tunnel.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/devices/nm-device-ip-tunnel.c b/src/devices/nm-device-ip-tunnel.c index 8732ddf9b5..ee3725434e 100644 --- a/src/devices/nm-device-ip-tunnel.c +++ b/src/devices/nm-device-ip-tunnel.c @@ -557,12 +557,13 @@ platform_link_to_tunnel_mode (const NMPlatformLink *link) return NM_IP_TUNNEL_MODE_GRE; case NM_LINK_TYPE_IP6TNL: lnk = nm_platform_link_get_lnk_ip6tnl (NM_PLATFORM_GET, link->ifindex, NULL); - if (lnk->proto == IPPROTO_IPIP) - return NM_IP_TUNNEL_MODE_IPIP6; - else if (lnk->proto == IPPROTO_IPV6) - return NM_IP_TUNNEL_MODE_IP6IP6; - else - return NM_IP_TUNNEL_MODE_UNKNOWN; + if (lnk) { + if (lnk->proto == IPPROTO_IPIP) + return NM_IP_TUNNEL_MODE_IPIP6; + if (lnk->proto == IPPROTO_IPV6) + return NM_IP_TUNNEL_MODE_IP6IP6; + } + return NM_IP_TUNNEL_MODE_UNKNOWN; case NM_LINK_TYPE_IPIP: return NM_IP_TUNNEL_MODE_IPIP; case NM_LINK_TYPE_SIT: |