This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 9fa9c5b0a netutils/dhcpc: Add configuration check for getrandom
9fa9c5b0a is described below

commit 9fa9c5b0a2469554ab8a30d44bcc2bd7c2b4e751
Author: makejian <makej...@xiaomi.com>
AuthorDate: Wed Oct 18 15:01:09 2023 +0800

    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 <makej...@xiaomi.com>
---
 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;

Reply via email to