xiaoxiang781216 commented on code in PR #1307:
URL: 
https://github.com/apache/incubator-nuttx-apps/pull/1307#discussion_r963020555


##########
netutils/dhcpc/dhcpc.c:
##########
@@ -665,6 +666,17 @@ int dhcpc_request(FAR void *handle, FAR struct dhcpc_state 
*presult)
   int     retries;
   int     state;
 
+  /* RFC2131: A DHCP client MUST choose 'xid's in such a
+   * way as to minimize the chance of using an 'xid' identical to one used
+   * by another client.
+   */
+
+  ret = getrandom(&xid, sizeof(xid), 0);

Review Comment:
   here is my suggestion:
   1.Move xid to dhcpc_state_s
   2.Initialize xid with random number in dhcp_open
   3.update inside dhcp_request



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to