Add logging if bind function fails
PATCH 1/1 Add logging if bind function fails
The bind function returns any errors it encounters but they were silently being discarded in this method. This at least logs this if debug messages are enabled.
In the future it would be nice to have this log even if the debug output isn't enabled as DHCP will not be working correctly.
--- ell/dhcp.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
ell/dhcp.c +8 -3
@@ -782,7 +782,7 @@ static void dhcp_client_rx_message(const void *data, size_t len, void *userdata)uint8_t msg_type =0 ;uint8_t t, l;const void *v; -int r; +int r, e;struct in_addr ia;CLIENT_DEBUG ("" );
@@ -855,9 +855,14 @@ static void dhcp_client_rx_message(const void *data, size_t len, void *userdata)l_timeout_remove (client->timeout_resend); client->timeout_resend =NULL ; -if (client->transport->bind) - client->transport->bind (client->transport, +if (client->transport->bind) { + e = client->transport->bind (client->transport, client->lease->address); +if (e <0 ) { +CLIENT_DEBUG ("Failed to bind dhcp socket. " +"Error %d: %s" , e,strerror (-e)); + } + }dhcp_client_event_notify (client, r);
Signature · 1 line
2.25.1
Denis Kenzior
AppliedHi Michael,
Quoted 10 lines · Michael Johnson
The bind function returns any errors it encounters but they were silently being discarded in this method. This at least logs this if debug messages are enabled.
In the future it would be nice to have this log even if the debug output isn't enabled as DHCP will not be working correctly.
--- ell/dhcp.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
Applied, thanks.
Regards,
-Denis