ip-tunnel: fail the activation for unknown tunnel modes

When an IP-tunnel connection with mode different from the implemented
ones was activated, an assertion failed in tunnel_mode_to_link_type().

Instead we should return NM_LINK_TYPE_UNKNOWN there and fail the
activation.
This commit is contained in:
Beniamino Galvani 2016-11-04 14:02:50 +01:00
parent 5aea82d383
commit 2805555bd2

View file

@ -586,7 +586,7 @@ tunnel_mode_to_link_type (NMIPTunnelMode tunnel_mode)
case NM_IP_TUNNEL_MODE_SIT:
return NM_LINK_TYPE_SIT;
default:
g_return_val_if_reached (NM_LINK_TYPE_UNKNOWN);
return NM_LINK_TYPE_UNKNOWN;
}
}
@ -1004,7 +1004,7 @@ create_device (NMDeviceFactory *factory,
mode = platform_link_to_tunnel_mode (plink);
}
if (mode == NM_IP_TUNNEL_MODE_UNKNOWN)
if (mode == NM_IP_TUNNEL_MODE_UNKNOWN || link_type == NM_LINK_TYPE_UNKNOWN)
return NULL;
return (NMDevice *) g_object_new (NM_TYPE_DEVICE_IP_TUNNEL,