dhcp: generate new xid for DHCP release

This commit is contained in:
Christoffer Lind 2021-03-02 15:57:42 +01:00 committed by Erik Ekman
parent 988ce1e80e
commit 600e248f06

View File

@ -1331,6 +1331,7 @@ dhcp_release_and_stop(struct netif *netif)
/* create and initialize the DHCP message header */
struct pbuf *p_out;
u16_t options_out_len;
dhcp_set_state(dhcp, DHCP_STATE_OFF);
p_out = dhcp_create_msg(netif, dhcp, DHCP_RELEASE, &options_out_len);
if (p_out != NULL) {
struct dhcp_msg *msg_out = (struct dhcp_msg *)p_out->payload;
@ -1350,9 +1351,9 @@ dhcp_release_and_stop(struct netif *netif)
/* remove IP address from interface (prevents routing from selecting this interface) */
netif_set_addr(netif, IP4_ADDR_ANY4, IP4_ADDR_ANY4, IP4_ADDR_ANY4);
}
} else {
dhcp_set_state(dhcp, DHCP_STATE_OFF);
}
if (dhcp->pcb_allocated != 0) {
dhcp_dec_pcb_refcount(); /* free DHCP PCB if not needed any more */