13627105546 opened a new pull request, #17871:
URL: https://github.com/apache/nuttx/pull/17871

   Use arc4random_buf instead of rand() to improve randomness quality and avoid 
using weak PRNG for MAC generation.
   
   *Note: Please adhere to [Contributing 
Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
   
   ## Summary
   
   Replace the usage of `rand()` and `srand()` with `arc4random_buf()` for 
generating the MAC address in the virtio-net driver.
   
   `rand()` is a weak pseudo-random number generator and is generally not 
suitable for generating unique identifiers like MAC addresses, as it can lead 
to collisions or predictable sequences. `arc4random_buf()` provides higher 
quality randomness.
   
   ## Impact
   
   *   **Impact on user**: Reduced risk of MAC address collisions when using 
virtio-net.
   *   **Backward compatibility**: Yes.
   *   **New feature**: No, improvement/bug fix.
   
   ## Testing
   
   *   **Target**: `qemu:virt` (virtio-net)
   *   **Verification**:
       *   Built and ran on QEMU with virtio-net enabled.
       *   Verified that the network interface comes up with a valid MAC 
address.
       *   Passed `tools/checkpatch.sh`.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to