mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-03-25 16:44:04 +00:00
DHCP uses LWIP_RAND() for xid's (bug #30302)
This commit is contained in:
parent
9a1eeeea67
commit
378bed8a03
@ -6,6 +6,9 @@ HISTORY
|
|||||||
|
|
||||||
++ New features:
|
++ New features:
|
||||||
|
|
||||||
|
2011-09-03: Simon Goldschmidt
|
||||||
|
* dhcp.c: DHCP uses LWIP_RAND() for xid's (bug #30302)
|
||||||
|
|
||||||
2011-08-24: Simon Goldschmidt
|
2011-08-24: Simon Goldschmidt
|
||||||
* opt.h, netif.h/.c: added netif remove callback (bug #32397)
|
* opt.h, netif.h/.c: added netif remove callback (bug #32397)
|
||||||
|
|
||||||
|
@ -83,6 +83,13 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
/** DHCP_CREATE_RAND_XID: if this is set to 1, the xid is created using
|
||||||
|
* LWIP_RAND() (this overrides DHCP_GLOBAL_XID)
|
||||||
|
*/
|
||||||
|
#ifndef DHCP_CREATE_RAND_XID
|
||||||
|
#define DHCP_CREATE_RAND_XID 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Default for DHCP_GLOBAL_XID is 0xABCD0000
|
/** Default for DHCP_GLOBAL_XID is 0xABCD0000
|
||||||
* This can be changed by defining DHCP_GLOBAL_XID and DHCP_GLOBAL_XID_HEADER, e.g.
|
* This can be changed by defining DHCP_GLOBAL_XID and DHCP_GLOBAL_XID_HEADER, e.g.
|
||||||
* #define DHCP_GLOBAL_XID_HEADER "stdlib.h"
|
* #define DHCP_GLOBAL_XID_HEADER "stdlib.h"
|
||||||
@ -1623,7 +1630,11 @@ dhcp_create_msg(struct netif *netif, struct dhcp *dhcp, u8_t message_type)
|
|||||||
* with a packet analyser). We simply increment for each new request.
|
* with a packet analyser). We simply increment for each new request.
|
||||||
* Predefine DHCP_GLOBAL_XID to a better value or a function call to generate one
|
* Predefine DHCP_GLOBAL_XID to a better value or a function call to generate one
|
||||||
* at runtime, any supporting function prototypes can be defined in DHCP_GLOBAL_XID_HEADER */
|
* at runtime, any supporting function prototypes can be defined in DHCP_GLOBAL_XID_HEADER */
|
||||||
|
#if DHCP_CREATE_RAND_XID && defined(LWIP_RAND)
|
||||||
|
static u32_t xid;
|
||||||
|
#else /* DHCP_CREATE_RAND_XID && defined(LWIP_RAND) */
|
||||||
static u32_t xid = 0xABCD0000;
|
static u32_t xid = 0xABCD0000;
|
||||||
|
#endif /* DHCP_CREATE_RAND_XID && defined(LWIP_RAND) */
|
||||||
#else
|
#else
|
||||||
if (!xid_initialised) {
|
if (!xid_initialised) {
|
||||||
xid = DHCP_GLOBAL_XID;
|
xid = DHCP_GLOBAL_XID;
|
||||||
@ -1645,7 +1656,11 @@ dhcp_create_msg(struct netif *netif, struct dhcp *dhcp, u8_t message_type)
|
|||||||
|
|
||||||
/* reuse transaction identifier in retransmissions */
|
/* reuse transaction identifier in retransmissions */
|
||||||
if (dhcp->tries == 0) {
|
if (dhcp->tries == 0) {
|
||||||
xid++;
|
#if DHCP_CREATE_RAND_XID && defined(LWIP_RAND)
|
||||||
|
xid = LWIP_RAND();
|
||||||
|
#else /* DHCP_CREATE_RAND_XID && defined(LWIP_RAND) */
|
||||||
|
xid++;
|
||||||
|
#endif /* DHCP_CREATE_RAND_XID && defined(LWIP_RAND) */
|
||||||
}
|
}
|
||||||
dhcp->xid = xid;
|
dhcp->xid = xid;
|
||||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE,
|
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user