device: add a new state-reason for DAD failures

(cherry picked from commit 12a49cbdc7)
This commit is contained in:
Beniamino Galvani 2017-11-02 14:22:10 +01:00
parent b86df65bba
commit 8a570a41cf
3 changed files with 8 additions and 3 deletions

View file

@ -399,9 +399,11 @@ nmc_device_reason_to_string (NMDeviceStateReason reason)
return _("The device's parent changed");
case NM_DEVICE_STATE_REASON_PARENT_MANAGED_CHANGED:
return _("The device parent's management changed");
case NM_DEVICE_STATE_REASON_OVSDB_FAILED:
return _("OpenVSwitch database connection failed");
case NM_DEVICE_STATE_REASON_IP_ADDRESS_DUPLICATE:
return _("A duplicate IP address was detected");
}
/* TRANSLATORS: Unknown reason for a device state change (NMDeviceStateReason) */

View file

@ -551,6 +551,7 @@ typedef enum {
* @NM_DEVICE_STATE_REASON_PARENT_CHANGED: the device's parent changed
* @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
*
* Device state change reason codes
*/
@ -619,6 +620,7 @@ typedef enum {
NM_DEVICE_STATE_REASON_PARENT_CHANGED = 61,
NM_DEVICE_STATE_REASON_PARENT_MANAGED_CHANGED = 62,
NM_DEVICE_STATE_REASON_OVSDB_FAILED = 63,
NM_DEVICE_STATE_REASON_IP_ADDRESS_DUPLICATE = 64,
} NMDeviceStateReason;
/**

View file

@ -650,6 +650,7 @@ NM_UTILS_LOOKUP_STR_DEFINE (nm_device_state_reason_to_str, NMDeviceStateReason,
NM_UTILS_LOOKUP_STR_ITEM (NM_DEVICE_STATE_REASON_PARENT_CHANGED, "parent-changed"),
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"),
);
#define reason_to_string(reason) \
@ -5493,7 +5494,7 @@ ipv4_manual_method_apply (NMDevice *self, NMIP4Config **configs, gboolean succes
g_object_unref (empty);
} else {
nm_device_ip_method_failed (self, AF_INET,
NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE);
NM_DEVICE_STATE_REASON_IP_ADDRESS_DUPLICATE);
}
}
@ -6077,7 +6078,7 @@ dhcp4_dad_cb (NMDevice *self, NMIP4Config **configs, gboolean success)
nm_device_activate_schedule_ip4_config_result (self, configs[1]);
else {
nm_device_ip_method_failed (self, AF_INET,
NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE);
NM_DEVICE_STATE_REASON_IP_ADDRESS_DUPLICATE);
}
}