fixed bug #40303 DHCP xid renewed when sending a DHCPREQUEST

This commit is contained in:
Simon Goldschmidt 2014-02-27 22:44:16 +01:00
parent d9d0c52770
commit c82f04f54c
2 changed files with 11 additions and 5 deletions

View File

@ -96,6 +96,9 @@ HISTORY
++ Bugfixes:
2014-02-27: Simon Goldschmidt
* dhcp.c: fixed bug #40303 DHCP xid renewed when sending a DHCPREQUEST
2014-02-27: Simon Goldschmidt
* raw.c: fixed bug #41680 raw socket can not receive IPv6 packet when
IP_SOF_BROADCAST_RECV==1

View File

@ -1671,15 +1671,18 @@ dhcp_create_msg(struct netif *netif, struct dhcp *dhcp, u8_t message_type)
LWIP_ASSERT("dhcp_create_msg: check that first pbuf can hold struct dhcp_msg",
(dhcp->p_out->len >= sizeof(struct dhcp_msg)));
/* reuse transaction identifier in retransmissions */
if (dhcp->tries == 0) {
/* DHCP_REQUEST should reuse 'xid' from DHCPOFFER */
if (message_type != DHCP_REQUEST) {
/* reuse transaction identifier in retransmissions */
if (dhcp->tries == 0) {
#if DHCP_CREATE_RAND_XID && defined(LWIP_RAND)
xid = LWIP_RAND();
xid = LWIP_RAND();
#else /* DHCP_CREATE_RAND_XID && defined(LWIP_RAND) */
xid++;
xid++;
#endif /* DHCP_CREATE_RAND_XID && defined(LWIP_RAND) */
}
dhcp->xid = xid;
}
dhcp->xid = xid;
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE,
("transaction id xid(%"X32_F")\n", xid));