Commit 33a88ca5 authored by Thomas Haller's avatar Thomas Haller
Browse files

core: give better error reason why device is incompatible with profile

Note the special error codes  NM_UTILS_ERROR_CONNECTION_AVAILABLE_*.
This will be used to determine, whether the profile is fundamentally
incompatible with the device, or whether just some other properties
mismatch. That information will be importand during a plain `nmcli
connection up`, where NetworkManager searches all devices for a device
to activate. If no device is found (and multiple errors happened),
we want to show the error that is most likely relevant for the user.

Also note, how NMDevice's check_connection_compatible() uses the new
class field "device_class->connection_type_check_compatible" to simplify
checks for compatible profiles.

The error reason is still unused.
parent 570e1fa7
......@@ -225,6 +225,40 @@ nm_connection_get_setting_by_name (NMConnection *connection, const char *name)
return type ? _connection_get_setting (connection, type) : NULL;
}
/*****************************************************************************/
gpointer /* (NMSetting *) */
_nm_connection_check_main_setting (NMConnection *connection,
const char *setting_name,
GError **error)
{
NMSetting *setting;
nm_assert (NM_IS_CONNECTION (connection));
nm_assert (setting_name);
if (!nm_connection_is_type (connection, setting_name)) {
nm_utils_error_set (error,
NM_UTILS_ERROR_CONNECTION_AVAILABLE_INCOMPATIBLE,
"connection type is not \"%s\"",
setting_name);
return NULL;
}
setting = nm_connection_get_setting_by_name (connection, setting_name);
if (!setting) {
nm_utils_error_set (error,
NM_UTILS_ERROR_CONNECTION_AVAILABLE_INCOMPATIBLE,
"connection misses \"%s\" settings",
setting_name);
return NULL;
}
return setting;
}
/*****************************************************************************/
static gboolean
validate_permissions_type (GVariant *variant, GError **error)
{
......
......@@ -140,6 +140,10 @@ gboolean _nm_connection_replace_settings (NMConnection *connection,
NMSettingParseFlags parse_flags,
GError **error);
gpointer _nm_connection_check_main_setting (NMConnection *connection,
const char *setting_name,
GError **error);
/**
* NMSettingVerifyResult:
* @NM_SETTING_VERIFY_SUCCESS: the setting verifies successfully
......
......@@ -87,25 +87,23 @@ get_generic_capabilities (NMDevice *dev)
}
static gboolean
check_connection_compatible (NMDevice *device, NMConnection *connection)
check_connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
{
NMSettingAdsl *s_adsl;
const char *protocol;
if (!NM_DEVICE_CLASS (nm_device_adsl_parent_class)->check_connection_compatible (device, connection))
return FALSE;
if (!nm_connection_is_type (connection, NM_SETTING_ADSL_SETTING_NAME))
if (!NM_DEVICE_CLASS (nm_device_adsl_parent_class)->check_connection_compatible (device, connection, error))
return FALSE;
s_adsl = nm_connection_get_setting_adsl (connection);
if (!s_adsl)
return FALSE;
/* FIXME: we don't yet support IPoATM */
protocol = nm_setting_adsl_get_protocol (s_adsl);
if (g_strcmp0 (protocol, NM_SETTING_ADSL_PROTOCOL_IPOATM) == 0)
if (nm_streq0 (protocol, NM_SETTING_ADSL_PROTOCOL_IPOATM)) {
/* FIXME: we don't yet support IPoATM */
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"IPoATM protocol is not yet supported");
return FALSE;
}
return TRUE;
}
......@@ -678,6 +676,8 @@ nm_device_adsl_class_init (NMDeviceAdslClass *klass)
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_adsl);
device_class->connection_type_check_compatible = NM_SETTING_ADSL_SETTING_NAME;
device_class->get_generic_capabilities = get_generic_capabilities;
device_class->check_connection_compatible = check_connection_compatible;
......
......@@ -157,36 +157,36 @@ can_auto_connect (NMDevice *device,
}
static gboolean
check_connection_compatible (NMDevice *device, NMConnection *connection)
check_connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
{
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE ((NMDeviceBt *) device);
NMSettingConnection *s_con;
NMSettingBluetooth *s_bt;
const char *bdaddr;
guint32 bt_type;
if (!NM_DEVICE_CLASS (nm_device_bt_parent_class)->check_connection_compatible (device, connection))
if (!NM_DEVICE_CLASS (nm_device_bt_parent_class)->check_connection_compatible (device, connection, error))
return FALSE;
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_BLUETOOTH_SETTING_NAME))
bt_type = get_connection_bt_type (connection);
if (!NM_FLAGS_ALL (priv->capabilities, bt_type)) {
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"device does not support bluetooth type of profile");
return FALSE;
}
s_bt = nm_connection_get_setting_bluetooth (connection);
if (!s_bt)
return FALSE;
bt_type = get_connection_bt_type (connection);
if (!(bt_type & priv->capabilities))
return FALSE;
bdaddr = nm_setting_bluetooth_get_bdaddr (s_bt);
if (!bdaddr)
if (!bdaddr) {
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"profile lacks bdaddr setting");
return FALSE;
if (!nm_utils_hwaddr_matches (priv->bdaddr, -1, bdaddr, -1))
}
if (!nm_utils_hwaddr_matches (priv->bdaddr, -1, bdaddr, -1)) {
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"devices bdaddr setting mismatches");
return FALSE;
}
return TRUE;
}
......@@ -1184,6 +1184,8 @@ nm_device_bt_class_init (NMDeviceBtClass *klass)
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_bluetooth);
device_class->connection_type_check_compatible = NM_SETTING_BLUETOOTH_SETTING_NAME;
device_class->get_generic_capabilities = get_generic_capabilities;
device_class->can_auto_connect = can_auto_connect;
device_class->deactivate = deactivate;
......
......@@ -174,21 +174,6 @@ is_available (NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
return NM_DEVICE_CLASS (nm_device_6lowpan_parent_class)->is_available (device, flags);
}
static gboolean
check_connection_compatible (NMDevice *device, NMConnection *connection)
{
NMSetting6Lowpan *s_6lowpan;
if (!NM_DEVICE_CLASS (nm_device_6lowpan_parent_class)->check_connection_compatible (device, connection))
return FALSE;
s_6lowpan = nm_connection_get_setting_6lowpan (connection);
if (!s_6lowpan)
return FALSE;
return TRUE;
}
static gboolean
complete_connection (NMDevice *device,
NMConnection *connection,
......@@ -249,7 +234,8 @@ update_connection (NMDevice *device, NMConnection *connection)
/* Don't change a parent specified by UUID if it's still valid */
parent_connection = (NMConnection *) nm_settings_get_connection_by_uuid (nm_device_get_settings (device), setting_parent);
if (parent_connection && nm_device_check_connection_compatible (parent_device, parent_connection))
if ( parent_connection
&& nm_device_check_connection_compatible (parent_device, parent_connection, NULL))
new_parent = NULL;
}
if (new_parent)
......@@ -299,10 +285,10 @@ nm_device_6lowpan_class_init (NMDevice6LowpanClass *klass)
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_6lowpan);
device_class->connection_type_supported = NM_SETTING_6LOWPAN_SETTING_NAME;
device_class->connection_type_check_compatible = NM_SETTING_6LOWPAN_SETTING_NAME;
device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES (NM_LINK_TYPE_6LOWPAN);
device_class->act_stage1_prepare = act_stage1_prepare;
device_class->check_connection_compatible = check_connection_compatible;
device_class->complete_connection = complete_connection;
device_class->create_and_realize = create_and_realize;
device_class->get_generic_capabilities = get_generic_capabilities;
......
......@@ -55,23 +55,6 @@ get_generic_capabilities (NMDevice *dev)
return NM_DEVICE_CAP_CARRIER_DETECT | NM_DEVICE_CAP_IS_SOFTWARE;
}
static gboolean
check_connection_compatible (NMDevice *device, NMConnection *connection)
{
NMSettingBond *s_bond;
if (!NM_DEVICE_CLASS (nm_device_bond_parent_class)->check_connection_compatible (device, connection))
return FALSE;
s_bond = nm_connection_get_setting_bond (connection);
if (!s_bond || !nm_connection_is_type (connection, NM_SETTING_BOND_SETTING_NAME))
return FALSE;
/* FIXME: match bond properties like mode, etc? */
return TRUE;
}
static gboolean
complete_connection (NMDevice *device,
NMConnection *connection,
......@@ -636,11 +619,11 @@ nm_device_bond_class_init (NMDeviceBondClass *klass)
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_bond);
device_class->connection_type_supported = NM_SETTING_BOND_SETTING_NAME;
device_class->connection_type_check_compatible = NM_SETTING_BOND_SETTING_NAME;
device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES (NM_LINK_TYPE_BOND);
device_class->is_master = TRUE;
device_class->get_generic_capabilities = get_generic_capabilities;
device_class->check_connection_compatible = check_connection_compatible;
device_class->complete_connection = complete_connection;
device_class->update_connection = update_connection;
......
......@@ -95,23 +95,29 @@ check_connection_available (NMDevice *device,
}
static gboolean
check_connection_compatible (NMDevice *device, NMConnection *connection)
check_connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
{
NMSettingBridge *s_bridge;
const char *mac_address;
if (!NM_DEVICE_CLASS (nm_device_bridge_parent_class)->check_connection_compatible (device, connection))
if (!NM_DEVICE_CLASS (nm_device_bridge_parent_class)->check_connection_compatible (device, connection, error))
return FALSE;
s_bridge = nm_connection_get_setting_bridge (connection);
if (!s_bridge)
return FALSE;
if ( nm_connection_is_type (connection, NM_SETTING_BLUETOOTH_SETTING_NAME)
&& _nm_connection_get_setting_bluetooth_for_nap (connection)) {
s_bridge = nm_connection_get_setting_bridge (connection);
if (!s_bridge) {
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"missing bridge setting for bluetooth NAP profile");
return FALSE;
}
if (!nm_connection_is_type (connection, NM_SETTING_BRIDGE_SETTING_NAME)) {
if ( nm_connection_is_type (connection, NM_SETTING_BLUETOOTH_SETTING_NAME)
&& _nm_connection_get_setting_bluetooth_for_nap (connection)) {
/* a bluetooth NAP connection is handled by the bridge */
} else
/* a bluetooth NAP connection is handled by the bridge.
*
* Proceed... */
} else {
s_bridge = _nm_connection_check_main_setting (connection, NM_SETTING_BRIDGE_SETTING_NAME, error);
if (!s_bridge)
return FALSE;
}
......@@ -120,8 +126,11 @@ check_connection_compatible (NMDevice *device, NMConnection *connection)
const char *hw_addr;
hw_addr = nm_device_get_hw_address (device);
if (!hw_addr || !nm_utils_hwaddr_matches (hw_addr, -1, mac_address, -1))
if (!hw_addr || !nm_utils_hwaddr_matches (hw_addr, -1, mac_address, -1)) {
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"mac address mismatches");
return FALSE;
}
}
return TRUE;
......
......@@ -117,21 +117,6 @@ create_and_realize (NMDevice *device,
return TRUE;
}
static gboolean
check_connection_compatible (NMDevice *device, NMConnection *connection)
{
NMSettingDummy *s_dummy;
if (!NM_DEVICE_CLASS (nm_device_dummy_parent_class)->check_connection_compatible (device, connection))
return FALSE;
s_dummy = nm_connection_get_setting_dummy (connection);
if (!s_dummy)
return FALSE;
return TRUE;
}
static NMActStageReturn
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
{
......@@ -176,10 +161,10 @@ nm_device_dummy_class_init (NMDeviceDummyClass *klass)
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_dummy);
device_class->connection_type_supported = NM_SETTING_DUMMY_SETTING_NAME;
device_class->connection_type_check_compatible = NM_SETTING_DUMMY_SETTING_NAME;
device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES (NM_LINK_TYPE_DUMMY);
device_class->complete_connection = complete_connection;
device_class->check_connection_compatible = check_connection_compatible;
device_class->create_and_realize = create_and_realize;
device_class->get_generic_capabilities = get_generic_capabilities;
device_class->update_connection = update_connection;
......
......@@ -343,23 +343,21 @@ match_subchans (NMDeviceEthernet *self, NMSettingWired *s_wired, gboolean *try_m
}
static gboolean
check_connection_compatible (NMDevice *device, NMConnection *connection)
check_connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
{
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (device);
NMSettingWired *s_wired;
if (!NM_DEVICE_CLASS (nm_device_ethernet_parent_class)->check_connection_compatible (device, connection))
if (!NM_DEVICE_CLASS (nm_device_ethernet_parent_class)->check_connection_compatible (device, connection, error))
return FALSE;
s_wired = nm_connection_get_setting_wired (connection);
if (nm_connection_is_type (connection, NM_SETTING_PPPOE_SETTING_NAME)) {
/* NOP */
} else if (nm_connection_is_type (connection, NM_SETTING_WIRED_SETTING_NAME)) {
s_wired = nm_connection_get_setting_wired (connection);
} else {
s_wired = _nm_connection_check_main_setting (connection, NM_SETTING_WIRED_SETTING_NAME, error);
if (!s_wired)
return FALSE;
} else
return FALSE;
}
if (s_wired) {
const char *mac, *perm_hw_addr;
......@@ -367,28 +365,43 @@ check_connection_compatible (NMDevice *device, NMConnection *connection)
const char * const *mac_blacklist;
int i;
if (!match_subchans (self, s_wired, &try_mac))
if (!match_subchans (self, s_wired, &try_mac)) {
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"s390 subchannels don't match");
return FALSE;
}
perm_hw_addr = nm_device_get_permanent_hw_address (device);
mac = nm_setting_wired_get_mac_address (s_wired);
if (perm_hw_addr) {
if (try_mac && mac && !nm_utils_hwaddr_matches (mac, -1, perm_hw_addr, -1))
if ( try_mac
&& mac
&& !nm_utils_hwaddr_matches (mac, -1, perm_hw_addr, -1)) {
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"permanent MAC address doesn't match");
return FALSE;
}
/* Check for MAC address blacklist */
mac_blacklist = nm_setting_wired_get_mac_address_blacklist (s_wired);
for (i = 0; mac_blacklist[i]; i++) {
if (!nm_utils_hwaddr_valid (mac_blacklist[i], ETH_ALEN)) {
g_warn_if_reached ();
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"invalid MAC in blacklist");
return FALSE;
}
if (nm_utils_hwaddr_matches (mac_blacklist[i], -1, perm_hw_addr, -1))
if (nm_utils_hwaddr_matches (mac_blacklist[i], -1, perm_hw_addr, -1)) {
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"permanent MAC address of device blacklisted");
return FALSE;
}
}
} else if (mac)
} else if (mac) {
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"device has no permanent MAC address to match");
return FALSE;
}
}
return TRUE;
......
......@@ -86,19 +86,19 @@ realize_start_notify (NMDevice *device, const NMPlatformLink *plink)
}
static gboolean
check_connection_compatible (NMDevice *device, NMConnection *connection)
check_connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
{
NMSettingConnection *s_con;
if (!NM_DEVICE_CLASS (nm_device_generic_parent_class)->check_connection_compatible (device, connection))
return FALSE;
if (!nm_connection_is_type (connection, NM_SETTING_GENERIC_SETTING_NAME))
if (!NM_DEVICE_CLASS (nm_device_generic_parent_class)->check_connection_compatible (device, connection, error))
return FALSE;
s_con = nm_connection_get_setting_connection (connection);
if (!nm_setting_connection_get_interface_name (s_con))
if (!nm_setting_connection_get_interface_name (s_con)) {
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"generic profiles need an interface name");
return FALSE;
}
return TRUE;
}
......@@ -230,6 +230,7 @@ nm_device_generic_class_init (NMDeviceGenericClass *klass)
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_generic);
device_class->connection_type_supported = NM_SETTING_GENERIC_SETTING_NAME;
device_class->connection_type_check_compatible = NM_SETTING_GENERIC_SETTING_NAME;
device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES (NM_LINK_TYPE_ANY);
device_class->realize_start_notify = realize_start_notify;
......
......@@ -123,30 +123,28 @@ get_configured_mtu (NMDevice *device, NMDeviceMtuSource *out_source)
}
static gboolean
check_connection_compatible (NMDevice *device, NMConnection *connection)
check_connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
{
NMSettingInfiniband *s_infiniband;
if (!NM_DEVICE_CLASS (nm_device_infiniband_parent_class)->check_connection_compatible (device, connection))
return FALSE;
if (!nm_connection_is_type (connection, NM_SETTING_INFINIBAND_SETTING_NAME))
return FALSE;
s_infiniband = nm_connection_get_setting_infiniband (connection);
if (!s_infiniband)
if (!NM_DEVICE_CLASS (nm_device_infiniband_parent_class)->check_connection_compatible (device, connection, error))
return FALSE;
if (nm_device_is_real (device)) {
const char *mac;
const char *hw_addr;
s_infiniband = nm_connection_get_setting_infiniband (connection);
mac = nm_setting_infiniband_get_mac_address (s_infiniband);
if (mac) {
hw_addr = nm_device_get_permanent_hw_address (device);
if ( !hw_addr
|| !nm_utils_hwaddr_matches (mac, -1, hw_addr, -1))
|| !nm_utils_hwaddr_matches (mac, -1, hw_addr, -1)) {
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"MAC address mismatches");
return FALSE;
}
}
}
......@@ -375,6 +373,7 @@ nm_device_infiniband_class_init (NMDeviceInfinibandClass *klass)
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_infiniband);
device_class->connection_type_supported = NM_SETTING_INFINIBAND_SETTING_NAME;
device_class->connection_type_check_compatible = NM_SETTING_INFINIBAND_SETTING_NAME;
device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES (NM_LINK_TYPE_INFINIBAND);
device_class->create_and_realize = create_and_realize;
......
......@@ -458,7 +458,7 @@ update_connection (NMDevice *device, NMConnection *connection)
/* Don't change a parent specified by UUID if it's still valid */
parent_connection = (NMConnection *) nm_settings_get_connection_by_uuid (nm_device_get_settings (device),
setting_parent);
if (parent_connection && nm_device_check_connection_compatible (parent, parent_connection))
if (parent_connection && nm_device_check_connection_compatible (parent, parent_connection, NULL))
new_parent = NULL;
}
if (new_parent)
......@@ -524,54 +524,79 @@ update_connection (NMDevice *device, NMConnection *connection)
}
static gboolean
check_connection_compatible (NMDevice *device, NMConnection *connection)
check_connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
{
NMDeviceIPTunnel *self = NM_DEVICE_IP_TUNNEL (device);
NMDeviceIPTunnelPrivate *priv = NM_DEVICE_IP_TUNNEL_GET_PRIVATE (self);
NMSettingIPTunnel *s_ip_tunnel;
const char *parent;
if (!NM_DEVICE_CLASS (nm_device_ip_tunnel_parent_class)->check_connection_compatible (device, connection))
if (!NM_DEVICE_CLASS (nm_device_ip_tunnel_parent_class)->check_connection_compatible (device, connection, error))
return FALSE;
s_ip_tunnel = nm_connection_get_setting_ip_tunnel (connection);
if (!s_ip_tunnel)
return FALSE;
if (nm_setting_ip_tunnel_get_mode (s_ip_tunnel) != priv->mode)
if (nm_setting_ip_tunnel_get_mode (s_ip_tunnel) != priv->mode) {
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"incompatible IP tunnel mode");
return FALSE;
}
if (nm_device_is_real (device)) {
/* Check parent interface; could be an interface name or a UUID */
parent = nm_setting_ip_tunnel_get_parent (s_ip_tunnel);
if (parent && !nm_device_match_parent (device, parent))
if (parent && !nm_device_match_parent (device, parent)) {
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"IP tunnel parent mismatches");
return FALSE;
}
if (!address_equal_pp (priv->addr_family,
nm_setting_ip_tunnel_get_local (s_ip_tunnel),
priv->local))
priv->local)) {
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"local IP tunnel address mismatches");
return FALSE;
}
if (!address_equal_pp (priv->addr_family,
nm_setting_ip_tunnel_get_remote (s_ip_tunnel),
priv->remote))
priv->remote)) {
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"remote IP tunnel address mismatches");
return FALSE;
}
if (nm_setting_ip_tunnel_get_ttl (s_ip_tunnel) != priv->ttl)
if (nm_setting_ip_tunnel_get_ttl (s_ip_tunnel) != priv->ttl) {
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"TTL of IP tunnel mismatches");
return FALSE;
}
if (nm_setting_ip_tunnel_get_tos (s_ip_tunnel) != priv->tos)
if (nm_setting_ip_tunnel_get_tos (s_ip_tunnel) != priv->tos) {
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"TOS of IP tunnel mismatches");
return FALSE;
}
if (priv->addr_family == AF_INET) {
if (nm_setting_ip_tunnel_get_path_mtu_discovery (s_ip_tunnel) != priv->path_mtu_discovery)
if (nm_setting_ip_tunnel_get_path_mtu_discovery (s_ip_tunnel) != priv->path_mtu_discovery) {
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"MTU discovery setting of IP tunnel mismatches");
return FALSE;
}
} else {
if (nm_setting_ip_tunnel_get_encapsulation_limit (s_ip_tunnel) != priv->encap_limit)
if (nm_setting_ip_tunnel_get_encapsulation_limit (s_ip_tunnel) != priv->encap_limit) {
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"encapsulation limit of IP tunnel mismatches");
return FALSE;
}
if (nm_setting_ip_tunnel_get_flow_label (s_ip_tunnel) != priv->flow_label)
if (nm_setting_ip_tunnel_get_flow_label (s_ip_tunnel) != priv->flow_label) {
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"flow-label of IP tunnel mismatches");
return FALSE;
}
}
}
......@@ -1044,6 +1069,7 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *klass)
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_ip_tunnel);
device_class->connection_type_supported = NM_SETTING_IP_TUNNEL_SETTING_NAME;
device_class->connection_type_check_compatible = NM_SETTING_IP_TUNNEL_SETTING_NAME;
device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES (NM_LINK_TYPE_GRE,
NM_LINK_TYPE_GRETAP,
NM_LINK_TYPE_IP6TNL,
......