From 9fa9c5b0a2469554ab8a30d44bcc2bd7c2b4e751 Mon Sep 17 00:00:00 2001 From: makejian Date: Wed, 18 Oct 2023 15:01:09 +0800 Subject: [PATCH] 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 --- netutils/dhcpc/dhcpc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/netutils/dhcpc/dhcpc.c b/netutils/dhcpc/dhcpc.c index 88ccbdacc..ae758a0a5 100644 --- a/netutils/dhcpc/dhcpc.c +++ b/netutils/dhcpc/dhcpc.c @@ -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;