diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2020-02-07 11:00:48 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2020-02-07 15:37:50 +0100 |
commit | db3e7ec8e080007611052ff88c18d05c0f49e482 (patch) | |
tree | 99712d56c153ff2b1b948a6cf3bc78cc60daa860 | |
parent | 63bde4436730b1d55ef7136172a90821f5048dda (diff) | |
download | NetworkManager-bg/nettools-request-free.tar.gz |
dhcp: nettools: move to failed state if event dispatch failsbg/nettools-request-free
-rw-r--r-- | src/dhcp/nm-dhcp-nettools.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/dhcp/nm-dhcp-nettools.c b/src/dhcp/nm-dhcp-nettools.c index da1d2598a8..0332010ea3 100644 --- a/src/dhcp/nm-dhcp-nettools.c +++ b/src/dhcp/nm-dhcp-nettools.c @@ -1063,8 +1063,18 @@ dhcp4_event_cb (int fd, int r; r = n_dhcp4_client_dispatch (priv->client); - if (r < 0) - return G_SOURCE_CONTINUE; + if (r < 0) { + /* FIXME: if any operation (e.g. send()) fails during the + * dispatch, n-dhcp4 returns an error without arming timers + * or progressing state, so the only reasonable thing to do + * is to move to failed state so that the client will be + * restarted. Ideally n-dhcp4 should retry failed operations + * a predefined number of times (possibly infinite). + */ + _LOGE ("error %d dispatching events", r); + nm_dhcp_client_set_state (NM_DHCP_CLIENT (self), NM_DHCP_STATE_FAIL, NULL, NULL); + return G_SOURCE_REMOVE; + } while (!n_dhcp4_client_pop_event (priv->client, &event) && event) { dhcp4_event_handle (self, event); |