netutils/dhcpc: Add configuration check for getrandom

Calling getrandom depends on 'CONFIG_DEV_URANDOM' or 'CONFIG_DEV_RANDOM'
depends on patch https://github.com/apache/nuttx/pull/10925
Signed-off-by: makejian <makejian@xiaomi.com>
This commit is contained in:
makejian 2023-10-18 15:01:09 +08:00 committed by Xiang Xiao
parent f117860a16
commit 9fa9c5b0a2

View File

@ -544,6 +544,7 @@ FAR void *dhcpc_open(FAR const char *interface, FAR const void *macaddr,
* used by another client.
*/
#if defined(CONFIG_DEV_URANDOM) || defined(CONFIG_DEV_RANDOM)
ret = getrandom(pdhcpc->xid, 4, 0);
if (ret != 4)
{
@ -553,6 +554,9 @@ FAR void *dhcpc_open(FAR const char *interface, FAR const void *macaddr,
memcpy(pdhcpc->xid, default_xid, 4);
}
}
#else
memcpy(pdhcpc->xid, default_xid, 4);
#endif
pdhcpc->interface = interface;
pdhcpc->maclen = maclen;