mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-14 11:00:29 +01:00
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.
This commit is contained in:
parent
a6416cbd13
commit
602247e8e3
1 changed files with 7 additions and 6 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue