dhcp: Stop client before notifying owner
PATCH 1/2 dhcp: Stop client before notifying owner
This enables the owner of the client object to restart it.
--- ell/dhcp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
ell/dhcp.c +3 -1
@@ -950,9 +950,11 @@ static void dhcp_client_rx_message(const void *data, size_t len, void *userdata)case DHCP_STATE_RENEWING :case DHCP_STATE_REBINDING :if (msg_type ==DHCP_MESSAGE_TYPE_NAK ) { +l_dhcp_client_stop (client); +dhcp_client_event_notify (client,L_DHCP_CLIENT_EVENT_NO_LEASE ); - goto error; +return ; }if (msg_type !=DHCP_MESSAGE_TYPE_ACK )
Signature · 1 line
2.13.6
PATCH 2/2 dhcp: Move error handling
With a single use case of 'error' label, eliminate it and move the error handling into the block where it is used.
--- ell/dhcp.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
ell/dhcp.c +5 -7
@@ -941,8 +941,11 @@ static void dhcp_client_rx_message(const void *data, size_t len, void *userdata)CLIENT_ENTER_STATE (DHCP_STATE_REQUESTING ); client->attempt =1 ; -if (dhcp_client_send_request (client) <0 ) - goto error; +if (dhcp_client_send_request (client) <0 ) { +l_dhcp_client_stop (client); + +return ; + }l_timeout_modify_ms (client->timeout_resend,dhcp_fuzz_secs (4 ));break ;
@@ -995,11 +998,6 @@ static void dhcp_client_rx_message(const void *data, size_t len, void *userdata)case DHCP_STATE_BOUND :break ; } - -return ; - -error: -l_dhcp_client_stop (client); } LIB_EXPORT struct l_dhcp_client *l_dhcp_client_new(uint32_t ifindex)
Signature · 1 line
2.13.6
Hi Tim,
Quoted 5 lines · Tim Kourt
This enables the owner of the client object to restart it.
--- ell/dhcp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Both applied, thanks.
Regards,
-Denis