diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2020-01-07 12:01:39 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2020-01-09 09:04:08 +0100 |
commit | 4bcdc3c1ebe3e2e8a967ff067ecb2a8cbfc2f6ab (patch) | |
tree | 83c056ffd263ab23dafe11a644d801265c0874ea | |
parent | 900af25263b8ea502a070549eb863c945de41940 (diff) | |
download | NetworkManager-4bcdc3c1ebe3e2e8a967ff067ecb2a8cbfc2f6ab.tar.gz |
n-dhcp4: allow calling listen() on already listening connection
When the client enters the INIT state, it calls listen() on the
connection connection to create the packet socket. However, if the
client is coming from the REBOOTING state after a NAK, the connection
is already in the listening state; do nothing in such case.
-rw-r--r-- | shared/n-dhcp4/src/n-dhcp4-c-connection.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/shared/n-dhcp4/src/n-dhcp4-c-connection.c b/shared/n-dhcp4/src/n-dhcp4-c-connection.c index e51a3e3249..f3ae44e2d9 100644 --- a/shared/n-dhcp4/src/n-dhcp4-c-connection.c +++ b/shared/n-dhcp4/src/n-dhcp4-c-connection.c @@ -139,6 +139,9 @@ int n_dhcp4_c_connection_listen(NDhcp4CConnection *connection) { _c_cleanup_(c_closep) int fd_packet = -1; int r; + if (connection->state == N_DHCP4_C_CONNECTION_STATE_PACKET) + return 0; + c_assert(connection->state == N_DHCP4_C_CONNECTION_STATE_INIT || connection->state == N_DHCP4_C_CONNECTION_STATE_DRAINING || connection->state == N_DHCP4_C_CONNECTION_STATE_UDP); |