Use pico_rand for DHCP xid, run cmake in load command

This commit is contained in:
Ian Gulliver
2026-04-05 21:30:21 +09:00
parent 28caa2e590
commit 4989cfd8cb
3 changed files with 11 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
#include "dhcp.h"
#include <span>
#include "pico/rand.h"
#include "w6300.h"
namespace dhcp_opt {
@@ -15,7 +16,7 @@ struct __attribute__((packed)) dhcp_discover {
uint8_t htype = 1;
uint8_t hlen = 6;
uint8_t hops = 0;
uint32_t xid = __builtin_bswap32(0x12345678);
uint32_t xid = __builtin_bswap32(static_cast<uint32_t>(get_rand_64()));
uint16_t secs = 0;
uint16_t flags = __builtin_bswap16(0x8000);
std::array<uint8_t, 4> ciaddr = {};