mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 05:18:23 +02:00
all: add more meaningful error code for unsupported IP method
Add a new device state reason code for unsupported IP method. It is
returned, for example, when users select manual IP configuration for
WWAN connections:
# nmcli connection mod Gsm ipv4.method manual ipv4.address 1.2.3.4/32
# nmcli connection up Gsm
Error: Connection activation failed: The selected IP method is not
supported
compared to the old:
Error: Connection activation failed: IP configuration could not be
reserved (no available address, timeout, etc.)
Note that we could instead fail the connection validation if the
method is not supported by the connection type, but adding such
limitation now could make existing connections invalid.
https://bugzilla.redhat.com/show_bug.cgi?id=1459529
(cherry picked from commit aa820e9386)
This commit is contained in:
parent
8a570a41cf
commit
207eb3266f
4 changed files with 7 additions and 4 deletions
|
|
@ -403,7 +403,8 @@ nmc_device_reason_to_string (NMDeviceStateReason reason)
|
|||
return _("OpenVSwitch database connection failed");
|
||||
case NM_DEVICE_STATE_REASON_IP_ADDRESS_DUPLICATE:
|
||||
return _("A duplicate IP address was detected");
|
||||
|
||||
case NM_DEVICE_STATE_REASON_IP_METHOD_UNSUPPORTED:
|
||||
return _("The selected IP method is not supported");
|
||||
}
|
||||
|
||||
/* TRANSLATORS: Unknown reason for a device state change (NMDeviceStateReason) */
|
||||
|
|
|
|||
|
|
@ -552,6 +552,7 @@ typedef enum {
|
|||
* @NM_DEVICE_STATE_REASON_PARENT_MANAGED_CHANGED: the device parent's management changed
|
||||
* @NM_DEVICE_STATE_REASON_OVSDB_FAILED: problem communicating with OpenVSwitch database
|
||||
* @NM_DEVICE_STATE_REASON_IP_ADDRESS_DUPLICATE: a duplicate IP address was detected
|
||||
* @NM_DEVICE_STATE_REASON_IP_METHOD_UNSUPPORTED: The selected IP method is not supported
|
||||
*
|
||||
* Device state change reason codes
|
||||
*/
|
||||
|
|
@ -621,6 +622,7 @@ typedef enum {
|
|||
NM_DEVICE_STATE_REASON_PARENT_MANAGED_CHANGED = 62,
|
||||
NM_DEVICE_STATE_REASON_OVSDB_FAILED = 63,
|
||||
NM_DEVICE_STATE_REASON_IP_ADDRESS_DUPLICATE = 64,
|
||||
NM_DEVICE_STATE_REASON_IP_METHOD_UNSUPPORTED = 65,
|
||||
} NMDeviceStateReason;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -651,6 +651,7 @@ NM_UTILS_LOOKUP_STR_DEFINE (nm_device_state_reason_to_str, NMDeviceStateReason,
|
|||
NM_UTILS_LOOKUP_STR_ITEM (NM_DEVICE_STATE_REASON_PARENT_MANAGED_CHANGED, "parent-managed-changed"),
|
||||
NM_UTILS_LOOKUP_STR_ITEM (NM_DEVICE_STATE_REASON_OVSDB_FAILED, "ovsdb-failed"),
|
||||
NM_UTILS_LOOKUP_STR_ITEM (NM_DEVICE_STATE_REASON_IP_ADDRESS_DUPLICATE, "ip-address-duplicate"),
|
||||
NM_UTILS_LOOKUP_STR_ITEM (NM_DEVICE_STATE_REASON_IP_METHOD_UNSUPPORTED, "ip-method-unsupported"),
|
||||
);
|
||||
|
||||
#define reason_to_string(reason) \
|
||||
|
|
|
|||
|
|
@ -685,9 +685,8 @@ nm_modem_stage3_ip4_config_start (NMModem *self,
|
|||
return NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
|
||||
if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) != 0) {
|
||||
_LOGW ("unhandled WWAN IPv4 method '%s'; will fail",
|
||||
method);
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE);
|
||||
_LOGE ("unhandled WWAN IPv4 method '%s'; will fail", method);
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_IP_METHOD_UNSUPPORTED);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue