Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Jul 2026 01:35:42 +0000
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: f4860c31b6ef - main - stand: Bump DHCP xid between transactions
Message-ID:  <6a6bfbee.1f09a.20ac5c8c@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by mav:

URL: https://cgit.FreeBSD.org/src/commit/?id=f4860c31b6eff06161a35a720423bb22d012fd03

commit f4860c31b6eff06161a35a720423bb22d012fd03
Author:     Alexander Motin <mav@FreeBSD.org>
AuthorDate: 2026-07-31 01:26:23 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2026-07-31 01:35:29 +0000

    stand: Bump DHCP xid between transactions
    
    Transaction ID should persist only between OFFER and the following
    REQUEST.  In all other cases it should change.
---
 stand/libsa/bootp.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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;


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a6bfbee.1f09a.20ac5c8c>