diff options
| author | Alexander Motin <mav@FreeBSD.org> | 2026-07-31 01:26:23 +0000 |
|---|---|---|
| committer | Alexander Motin <mav@FreeBSD.org> | 2026-07-31 01:35:29 +0000 |
| commit | f4860c31b6eff06161a35a720423bb22d012fd03 (patch) | |
| tree | c4598b3ffc23761b72c873c1713214b14c2e70c8 | |
| parent | 491f8d06a97ddea44857725537d1031f2d6a9889 (diff) | |
stand: Bump DHCP xid between transactions
Transaction ID should persist only between OFFER and the following
REQUEST. In all other cases it should change.
| -rw-r--r-- | stand/libsa/bootp.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/stand/libsa/bootp.c b/stand/libsa/bootp.c index 5143bc91ff08..51f463d55521 100644 --- a/stand/libsa/bootp.c +++ b/stand/libsa/bootp.c @@ -172,7 +172,12 @@ restart: bootp_response->bp_yiaddr.s_addr != INADDR_ANY) { init_reboot = true; rbootp = bootp_response; - d->xid = ntohl(rbootp->bp_xid); + /* + * INIT-REBOOT is a new DHCP transaction, distinct from + * the firmware's cached DISCOVER/OFFER/REQUEST/ACK. + * Use the firmware's xid just as an entropy source. + */ + d->xid = ntohl(rbootp->bp_xid) + 1; DEBUG_PRINTF(1, ("bootp: using cached DHCP reply " "(INIT-REBOOT), yiaddr=%s xid=0x%08x\n", inet_ntoa(rbootp->bp_yiaddr), (unsigned)d->xid)); @@ -259,6 +264,7 @@ restart: bootp_response = NULL; bootp_response_size = 0; init_reboot = false; + ++d->xid; if (pkt != NULL) { free(pkt); pkt = NULL; |
