n-dhcp4: send request directly to avoid unnecessary retransmission timeout

Using `n_dhcp4_c_connection_start_request()` will cause staying in
`connection->request`, as a result, it will cause the resending of
DHCPRELEASE and DHCPDECLINE message, thus, use
`n_dhcp4_c_connection_send_request()` directly instead to avoid
unnecessary retransmission timeout, as suggested by
f030927a54 (r1531834009).
This commit is contained in:
Wen Liang
2024-12-16 10:03:51 -05:00
parent bccf031591
commit 55710d3d7c
3 changed files with 8 additions and 5 deletions

View File

@@ -1010,9 +1010,9 @@ static const char *message_type_to_str(uint8_t type) {
} }
} }
static int n_dhcp4_c_connection_send_request(NDhcp4CConnection *connection, int n_dhcp4_c_connection_send_request(NDhcp4CConnection *connection,
NDhcp4Outgoing *request, NDhcp4Outgoing *request,
uint64_t timestamp) { uint64_t timestamp) {
char server_addr[INET_ADDRSTRLEN]; char server_addr[INET_ADDRSTRLEN];
char client_addr[INET_ADDRSTRLEN]; char client_addr[INET_ADDRSTRLEN];
char error_msg[128]; char error_msg[128];

View File

@@ -1137,7 +1137,7 @@ int n_dhcp4_client_probe_transition_decline(NDhcp4ClientProbe *probe, NDhcp4Inco
if (r) if (r)
return r; return r;
r = n_dhcp4_c_connection_start_request(&probe->connection, request, ns_now); r = n_dhcp4_c_connection_send_request(&probe->connection, request, ns_now);
if (r) if (r)
return r; return r;
else else
@@ -1340,7 +1340,7 @@ int n_dhcp4_client_probe_release(NDhcp4ClientProbe *probe) {
if (r) if (r)
return r; return r;
r = n_dhcp4_c_connection_start_request(&probe->connection, request_out, 0); r = n_dhcp4_c_connection_send_request(&probe->connection, request_out, 0);
if (r) if (r)
return r; return r;

View File

@@ -642,6 +642,9 @@ int n_dhcp4_c_connection_release_new(NDhcp4CConnection *connection,
int n_dhcp4_c_connection_start_request(NDhcp4CConnection *connection, int n_dhcp4_c_connection_start_request(NDhcp4CConnection *connection,
NDhcp4Outgoing *request, NDhcp4Outgoing *request,
uint64_t timestamp); uint64_t timestamp);
int n_dhcp4_c_connection_send_request(NDhcp4CConnection *connection,
NDhcp4Outgoing *request,
uint64_t timestamp);
int n_dhcp4_c_connection_dispatch_timer(NDhcp4CConnection *connection, int n_dhcp4_c_connection_dispatch_timer(NDhcp4CConnection *connection,
uint64_t timestamp); uint64_t timestamp);
int n_dhcp4_c_connection_dispatch_io(NDhcp4CConnection *connection, int n_dhcp4_c_connection_dispatch_io(NDhcp4CConnection *connection,