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.

(cherry picked from commit 9761e38f7e)
(cherry picked from commit 62ae5c0d0d)
This commit is contained in:
Thomas Haller 2022-05-10 11:10:56 +02:00 committed by Beniamino Galvani
parent d15e64360a
commit 87ee78e3cc
2 changed files with 2 additions and 2 deletions

View file

@ -983,7 +983,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 {