You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/09/05 15:25:19 UTC

[GitHub] [incubator-nuttx-apps] XinStellaris commented on a diff in pull request #1307: netutils/dhcpc:Make DHCP xid random

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


##########
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:
   I think we should put it in dhcp request, so that if we keep the dhcpc thread, xid will change every time just like the rfc requested.



-- 
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-unsubscribe@nuttx.apache.org

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