mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 00:38:07 +02:00
core: add NMActivationStateFlags "layer2-ready", "ip4-ready", and "ip6-ready"
This commit is contained in:
parent
e96df2c927
commit
50c62edccb
3 changed files with 42 additions and 0 deletions
|
|
@ -882,6 +882,9 @@ typedef enum {
|
|||
* @NM_ACTIVATION_STATE_FLAG_NONE: an alias for numeric zero, no flags set.
|
||||
* @NM_ACTIVATION_STATE_FLAG_IS_MASTER: the device is a master.
|
||||
* @NM_ACTIVATION_STATE_FLAG_IS_SLAVE: the device is a slave.
|
||||
* @NM_ACTIVATION_STATE_FLAG_LAYER2_READY: layer2 is activated and ready.
|
||||
* @NM_ACTIVATION_STATE_FLAG_IP4_READY: IPv4 setting is completed.
|
||||
* @NM_ACTIVATION_STATE_FLAG_IP6_READY: IPv6 setting is completed.
|
||||
*
|
||||
* Flags describing the current activation state.
|
||||
*
|
||||
|
|
@ -892,6 +895,9 @@ typedef enum { /*< flags >*/
|
|||
|
||||
NM_ACTIVATION_STATE_FLAG_IS_MASTER = (1LL << 0),
|
||||
NM_ACTIVATION_STATE_FLAG_IS_SLAVE = (1LL << 1),
|
||||
NM_ACTIVATION_STATE_FLAG_LAYER2_READY = (1LL << 2),
|
||||
NM_ACTIVATION_STATE_FLAG_IP4_READY = (1LL << 3),
|
||||
NM_ACTIVATION_STATE_FLAG_IP6_READY = (1LL << 4),
|
||||
} NMActivationStateFlags;
|
||||
|
||||
#endif /* __NM_DBUS_INTERFACE_H__ */
|
||||
|
|
|
|||
|
|
@ -746,6 +746,25 @@ nm_device_sys_iface_state_set (NMDevice *self,
|
|||
nm_assert (priv->sys_iface_state == sys_iface_state);
|
||||
}
|
||||
|
||||
static void
|
||||
_active_connection_set_state_flags_full (NMDevice *self,
|
||||
NMActivationStateFlags flags,
|
||||
NMActivationStateFlags mask)
|
||||
{
|
||||
NMActiveConnection *ac;
|
||||
|
||||
ac = NM_ACTIVE_CONNECTION (nm_device_get_act_request (self));
|
||||
if (ac)
|
||||
nm_active_connection_set_state_flags_full (ac, flags, mask);
|
||||
}
|
||||
|
||||
static void
|
||||
_active_connection_set_state_flags (NMDevice *self,
|
||||
NMActivationStateFlags flags)
|
||||
{
|
||||
_active_connection_set_state_flags_full (self, flags, flags);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
|
|
@ -993,6 +1012,17 @@ _set_ip_state (NMDevice *self, int addr_family, IpState new_state)
|
|||
(int) new_state,
|
||||
_ip_state_to_string (new_state));
|
||||
*p = new_state;
|
||||
|
||||
if (new_state == IP_DONE) {
|
||||
/* we only set the IPx_READY flag once we reach IP_DONE state. We don't
|
||||
* ever clear it, even if we later enter IP_FAIL state.
|
||||
*
|
||||
* This is not documented/guaranteed behavior, but seems to make sense for now. */
|
||||
_active_connection_set_state_flags (self,
|
||||
addr_family == AF_INET
|
||||
? NM_ACTIVATION_STATE_FLAG_IP4_READY
|
||||
: NM_ACTIVATION_STATE_FLAG_IP6_READY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -8085,6 +8115,9 @@ activate_stage3_ip_config_start (NMDevice *self)
|
|||
_set_ip_state (self, AF_INET, IP_WAIT);
|
||||
_set_ip_state (self, AF_INET6, IP_WAIT);
|
||||
|
||||
_active_connection_set_state_flags (self,
|
||||
NM_ACTIVATION_STATE_FLAG_LAYER2_READY);
|
||||
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_IP_CONFIG, NM_DEVICE_STATE_REASON_NONE);
|
||||
|
||||
/* Device should be up before we can do anything with it */
|
||||
|
|
|
|||
|
|
@ -150,6 +150,9 @@ NM_UTILS_FLAGS2STR_DEFINE_STATIC (_state_flags_to_string, NMActivationStateFlags
|
|||
NM_UTILS_FLAGS2STR (NM_ACTIVATION_STATE_FLAG_NONE, "none"),
|
||||
NM_UTILS_FLAGS2STR (NM_ACTIVATION_STATE_FLAG_IS_MASTER, "is-master"),
|
||||
NM_UTILS_FLAGS2STR (NM_ACTIVATION_STATE_FLAG_IS_SLAVE, "is-slave"),
|
||||
NM_UTILS_FLAGS2STR (NM_ACTIVATION_STATE_FLAG_LAYER2_READY, "layer2-ready"),
|
||||
NM_UTILS_FLAGS2STR (NM_ACTIVATION_STATE_FLAG_IP4_READY, "ip4-ready"),
|
||||
NM_UTILS_FLAGS2STR (NM_ACTIVATION_STATE_FLAG_IP6_READY, "ip6-ready"),
|
||||
);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue