summaryrefslogtreecommitdiff
path: root/src/devices/nm-device.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-03-01 17:26:45 +0100
committerThomas Haller <thaller@redhat.com>2017-03-16 18:27:33 +0100
commit9e60de87f54c1832d26dc44b0e08326e63c39e2b (patch)
tree650b63872671ee6c90c40259174f7b159b36baf9 /src/devices/nm-device.c
parentc59532ee40419e4ed7d31f1d1edbaa6bc3c2278e (diff)
downloadNetworkManager-9e60de87f54c1832d26dc44b0e08326e63c39e2b.tar.gz
core: minor cleanups
Some minor changes that make the code more similar to what will be done later for the related bug bgo#746440.
Diffstat (limited to 'src/devices/nm-device.c')
-rw-r--r--src/devices/nm-device.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index cb1cc63707..f9c492706b 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -206,6 +206,7 @@ typedef struct _NMDevicePrivate {
NMDeviceState state;
NMDeviceStateReason reason;
} queued_state;
+
guint queued_ip4_config_id;
guint queued_ip6_config_id;
GSList *pending_actions;
@@ -250,6 +251,8 @@ typedef struct _NMDevicePrivate {
NMUtilsStableType current_stable_id_type:3;
+ bool is_nm_owned:1; /* whether the device is a device owned and created by NM */
+
GHashTable * available_connections;
char * hw_addr;
char * hw_addr_perm;
@@ -259,7 +262,6 @@ typedef struct _NMDevicePrivate {
NMUnmanagedFlags unmanaged_mask;
NMUnmanagedFlags unmanaged_flags;
- bool is_nm_owned; /* whether the device is a device owned and created by NM */
DeleteOnDeactivateData *delete_on_deactivate_data; /* data for scheduled cleanup when deleting link (g_idle_add) */
GCancellable *deactivating_cancellable;
@@ -289,15 +291,16 @@ typedef struct _NMDevicePrivate {
guint link_connected_id;
guint link_disconnected_id;
guint carrier_defer_id;
- bool carrier;
guint carrier_wait_id;
- bool ignore_carrier;
gulong ignore_carrier_id;
guint32 mtu;
guint32 ip6_mtu;
guint32 mtu_initial;
guint32 ip6_mtu_initial;
+ bool carrier:1;
+ bool ignore_carrier:1;
+
bool mtu_initialized:1;
bool up:1; /* IFF_UP */
@@ -1725,7 +1728,7 @@ nm_device_master_release_one_slave (NMDevice *self, NMDevice *slave, gboolean co
info = find_slave_info (self, slave);
- _LOGt (LOGD_CORE, "master: release one slave %p/%s%s", slave, nm_device_get_iface (slave),
+ _LOGT (LOGD_CORE, "master: release one slave %p/%s%s", slave, nm_device_get_iface (slave),
!info ? " (not registered)" : "");
if (!info)
@@ -3005,7 +3008,7 @@ nm_device_master_add_slave (NMDevice *self, NMDevice *slave, gboolean configure)
info = find_slave_info (self, slave);
- _LOGt (LOGD_CORE, "master: add one slave %p/%s%s", slave, nm_device_get_iface (slave),
+ _LOGT (LOGD_CORE, "master: add one slave %p/%s%s", slave, nm_device_get_iface (slave),
info ? " (already registered)" : "");
if (configure)
@@ -3248,15 +3251,19 @@ nm_device_slave_notify_release (NMDevice *self, NMDeviceStateReason reason)
if ( priv->state > NM_DEVICE_STATE_DISCONNECTED
&& priv->state <= NM_DEVICE_STATE_ACTIVATED) {
- if (nm_device_state_reason_check (reason) == NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED) {
+ switch (nm_device_state_reason_check (reason)) {
+ case NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED:
new_state = NM_DEVICE_STATE_FAILED;
master_status = "failed";
- } else if (nm_device_state_reason_check (reason) == NM_DEVICE_STATE_REASON_USER_REQUESTED) {
+ break;
+ case NM_DEVICE_STATE_REASON_USER_REQUESTED:
new_state = NM_DEVICE_STATE_DEACTIVATING;
master_status = "deactivated by user request";
- } else {
+ break;
+ default:
new_state = NM_DEVICE_STATE_DISCONNECTED;
master_status = "deactivated";
+ break;
}
_LOGD (LOGD_DEVICE, "Activation: connection '%s' master %s",
@@ -3920,12 +3927,14 @@ recheck_available (gpointer user_data)
{
NMDevice *self = NM_DEVICE (user_data);
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
- gboolean now_available = nm_device_is_available (self, NM_DEVICE_CHECK_DEV_AVAILABLE_NONE);
+ gboolean now_available;
NMDeviceState state = nm_device_get_state (self);
NMDeviceState new_state = NM_DEVICE_STATE_UNKNOWN;
priv->recheck_available.call_id = 0;
+ now_available = nm_device_is_available (self, NM_DEVICE_CHECK_DEV_AVAILABLE_NONE);
+
if (state == NM_DEVICE_STATE_UNAVAILABLE && now_available) {
new_state = NM_DEVICE_STATE_DISCONNECTED;
nm_device_queue_state (self, new_state, priv->recheck_available.available_reason);