diff options
Diffstat (limited to 'shared')
| -rw-r--r-- | shared/n-dhcp4/src/n-dhcp4-c-probe.c | 13 | ||||
| -rw-r--r-- | shared/n-dhcp4/src/n-dhcp4-incoming.c | 8 | ||||
| -rw-r--r-- | shared/nm-glib-aux/nm-shared-utils.h | 8 | ||||
| -rw-r--r-- | shared/nm-version-macros.h | 2 |
4 files changed, 19 insertions, 12 deletions
diff --git a/shared/n-dhcp4/src/n-dhcp4-c-probe.c b/shared/n-dhcp4/src/n-dhcp4-c-probe.c index 5bed15b8..bfead036 100644 --- a/shared/n-dhcp4/src/n-dhcp4-c-probe.c +++ b/shared/n-dhcp4/src/n-dhcp4-c-probe.c @@ -841,11 +841,10 @@ static int n_dhcp4_client_probe_transition_lifetime(NDhcp4ClientProbe *probe) { return r; c_assert(probe->client->current_probe == probe); - probe->client->current_probe = NULL; - - n_dhcp4_c_connection_close(&probe->connection); + probe->current_lease = n_dhcp4_client_lease_unref(probe->current_lease); - probe->state = N_DHCP4_CLIENT_PROBE_STATE_EXPIRED; + probe->state = N_DHCP4_CLIENT_PROBE_STATE_INIT; + probe->ns_deferred = n_dhcp4_gettime(CLOCK_BOOTTIME) + UINT64_C(1); break; @@ -1005,9 +1004,9 @@ static int n_dhcp4_client_probe_transition_nak(NDhcp4ClientProbe *probe) { probe->state = N_DHCP4_CLIENT_PROBE_STATE_INIT; probe->ns_deferred = n_dhcp4_gettime(CLOCK_BOOTTIME) + probe->ns_nak_restart_delay; - probe->ns_nak_restart_delay = C_CLAMP(probe->ns_nak_restart_delay * 2, - UINT64_C(1000000000 * 2), - UINT64_C(1000000000 * 300)); + probe->ns_nak_restart_delay = C_CLAMP(probe->ns_nak_restart_delay * 2u, + UINT64_C(2) * UINT64_C(1000000000), + UINT64_C(300) * UINT64_C(1000000000)); break; case N_DHCP4_CLIENT_PROBE_STATE_SELECTING: case N_DHCP4_CLIENT_PROBE_STATE_INIT_REBOOT: diff --git a/shared/n-dhcp4/src/n-dhcp4-incoming.c b/shared/n-dhcp4/src/n-dhcp4-incoming.c index e7234c0a..f739413b 100644 --- a/shared/n-dhcp4/src/n-dhcp4-incoming.c +++ b/shared/n-dhcp4/src/n-dhcp4-incoming.c @@ -326,7 +326,7 @@ static int n_dhcp4_incoming_query_u8(NDhcp4Incoming *message, uint8_t option, ui r = n_dhcp4_incoming_query(message, option, &data, &n_data); if (r) return r; - else if (n_data != sizeof(*data)) + else if (n_data < sizeof(*data)) return N_DHCP4_E_MALFORMED; *u8p = *data; @@ -342,7 +342,7 @@ static int n_dhcp4_incoming_query_u16(NDhcp4Incoming *message, uint8_t option, u r = n_dhcp4_incoming_query(message, option, &data, &n_data); if (r) return r; - else if (n_data != sizeof(be16)) + else if (n_data < sizeof(be16)) return N_DHCP4_E_MALFORMED; memcpy(&be16, data, sizeof(be16)); @@ -360,7 +360,7 @@ static int n_dhcp4_incoming_query_u32(NDhcp4Incoming *message, uint8_t option, u r = n_dhcp4_incoming_query(message, option, &data, &n_data); if (r) return r; - else if (n_data != sizeof(be32)) + else if (n_data < sizeof(be32)) return N_DHCP4_E_MALFORMED; memcpy(&be32, data, sizeof(be32)); @@ -378,7 +378,7 @@ static int n_dhcp4_incoming_query_in_addr(NDhcp4Incoming *message, uint8_t optio r = n_dhcp4_incoming_query(message, option, &data, &n_data); if (r) return r; - else if (n_data != sizeof(be32)) + else if (n_data < sizeof(be32)) return N_DHCP4_E_MALFORMED; memcpy(&be32, data, sizeof(be32)); diff --git a/shared/nm-glib-aux/nm-shared-utils.h b/shared/nm-glib-aux/nm-shared-utils.h index 3bd1afae..3ec19ee1 100644 --- a/shared/nm-glib-aux/nm-shared-utils.h +++ b/shared/nm-glib-aux/nm-shared-utils.h @@ -973,6 +973,14 @@ NM_AUTO_DEFINE_FCN0 (GSource *, _nm_auto_destroy_and_unref_gsource, nm_g_source_ NM_AUTO_DEFINE_FCN0 (GMainContext *, _nm_auto_pop_gmaincontext, g_main_context_pop_thread_default) #define nm_auto_pop_gmaincontext nm_auto (_nm_auto_pop_gmaincontext) +static inline gboolean +nm_source_func_unref_gobject (gpointer user_data) +{ + nm_assert (G_IS_OBJECT (user_data)); + g_object_unref (user_data); + return G_SOURCE_REMOVE; +} + GSource *nm_g_idle_source_new (int priority, GSourceFunc func, gpointer user_data, diff --git a/shared/nm-version-macros.h b/shared/nm-version-macros.h index b8c5fbb9..f7365857 100644 --- a/shared/nm-version-macros.h +++ b/shared/nm-version-macros.h @@ -30,7 +30,7 @@ * Evaluates to the micro version number of NetworkManager which this source * compiled against. */ -#define NM_MICRO_VERSION (4) +#define NM_MICRO_VERSION (6) /** * NM_CHECK_VERSION: |