dhcpc:fix xid error clear bug.
Signed-off-by: 田昕 <tianxin7@xiaomi.com>
This commit is contained in:
parent
fa6aeb3e12
commit
e69a032f20
@ -532,6 +532,10 @@ FAR void *dhcpc_open(FAR const char *interface, FAR const void *macaddr,
|
|||||||
pdhcpc = malloc(sizeof(struct dhcpc_state_s) + maclen - 1);
|
pdhcpc = malloc(sizeof(struct dhcpc_state_s) + maclen - 1);
|
||||||
if (pdhcpc)
|
if (pdhcpc)
|
||||||
{
|
{
|
||||||
|
/* Initialize the allocated structure */
|
||||||
|
|
||||||
|
memset(pdhcpc, 0, sizeof(struct dhcpc_state_s));
|
||||||
|
|
||||||
/* RFC2131: A DHCP client MUST choose 'xid's in such a
|
/* RFC2131: A DHCP client MUST choose 'xid's in such a
|
||||||
* way as to minimize the chance of using an 'xid' identical to one
|
* way as to minimize the chance of using an 'xid' identical to one
|
||||||
* used by another client.
|
* used by another client.
|
||||||
@ -547,9 +551,6 @@ FAR void *dhcpc_open(FAR const char *interface, FAR const void *macaddr,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the allocated structure */
|
|
||||||
|
|
||||||
memset(pdhcpc, 0, sizeof(struct dhcpc_state_s));
|
|
||||||
pdhcpc->interface = interface;
|
pdhcpc->interface = interface;
|
||||||
pdhcpc->maclen = maclen;
|
pdhcpc->maclen = maclen;
|
||||||
memcpy(pdhcpc->macaddr, macaddr, pdhcpc->maclen);
|
memcpy(pdhcpc->macaddr, macaddr, pdhcpc->maclen);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user