dhcp: fix handling of NM_DHCP_STATE_NOOP

The "noop" state is almost unused, however, nm_dhcp_set_state()
has a check "if (new_state >= NM_DHCP_STATE_TIMEOUT)", so the order
of the NOOP state matters.

Fix that by reordering.

Also, just return right away from NOOP.
This commit is contained in:
Thomas Haller 2022-05-10 11:10:56 +02:00
parent f102051a29
commit 9761e38f7e
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
2 changed files with 2 additions and 2 deletions

View file

@ -971,7 +971,7 @@ nm_dhcp_client_handle_event(gpointer unused,
else if (NM_IN_STRSET_ASCII_CASE(reason, "fail", "abend"))
new_state = NM_DHCP_STATE_FAIL;
else if (NM_IN_STRSET_ASCII_CASE(reason, "preinit"))
new_state = NM_DHCP_STATE_NOOP;
return TRUE;
else
new_state = NM_DHCP_STATE_UNKNOWN;
}

View file

@ -28,6 +28,7 @@
typedef enum {
NM_DHCP_STATE_UNKNOWN = 0,
NM_DHCP_STATE_NOOP, /* state is a non operation for NetworkManager */
NM_DHCP_STATE_BOUND, /* new lease */
NM_DHCP_STATE_EXTENDED, /* lease extended */
NM_DHCP_STATE_TIMEOUT, /* timed out contacting server */
@ -35,7 +36,6 @@ typedef enum {
NM_DHCP_STATE_EXPIRE, /* lease expired or NAKed */
NM_DHCP_STATE_FAIL, /* failed for some reason */
NM_DHCP_STATE_TERMINATED, /* client is no longer running */
NM_DHCP_STATE_NOOP, /* state is a non operation for NetworkManager */
} NMDhcpState;
typedef enum _nm_packed {