Act nowcan affect a running systemThe raw payload has no superseded_by markers. Its merge commit contains the DHCPNAK frame correction from an earlier-authored branch commit that is not listed separately in this time window; the embedded merge diff was reviewed and is summarized in the edition. The avoid range follows the visible 16857–16860 sequence in which DhcpIP4 completes the new REQUEST checks.
DHCP request ownership and short numeric parsing are corrected
DHCP servers now follow the client state and selected-server rules more closely: NAK frames are cleaned up, requests naming another server are ignored, and stale static addresses are rejected. A follow-up prevents malformed address options from being mistaken for real IPv4 values. Separately, GetExtended stops reading four bytes from one- or two-character invalid input, so services parsing untrusted numeric text should take this edition.
TL;DR
- Land on build 2.4.16861; builds 2.4.16857 through 2.4.16859 can misinterpret malformed DHCP options 50 or 54 as real addresses.
- GetExtended now rejects short invalid tokens before its four-byte NAN/INF probe, preventing a potential read past the supplied text.
- A DHCP REQUEST whose server-identifier names another server is ignored and counted with the new dsmDroppedOtherServer metric.
- A client explicitly requesting an address that no longer matches its static reservation now receives a NAK instead of a renewal ACK.
- DHCPNAK frames omit lease, network, boot and rule options, preserve the packet chaddr, and broadcast when no relay is present.
- DhcpIP4 now returns zero for absent or malformed four-byte options, completing the new REQUEST checks without false NAK or drop decisions.
Upgrade advice
Take build 2.4.16861 as a complete unit if you run TDhcpServer or pass untrusted text to GetExtended. Do not stop on builds 2.4.16857–2.4.16859: the new DHCP option 50/54 decisions depend on DhcpIP4 returning zero for malformed data, which is fixed in 16860. Recheck DHCP REQUEST/NAK traffic, static reservation moves and any persisted numeric TDhcpScopeMetric ordinals after upgrading.
6 of 6 entries · 7 commits upstream
1
High
Moved static reservations reject the client’s stale requested address
When TDhcpProcess.LockedResponse finds an lsStatic lease, it now reads option 50 into State.Ip4. For SELECTING or INIT-REBOOT requests with an explicit nonzero address different from the reserved p^.IP4, it returns DoError(State, dsmNak) instead of incrementing dsmLeaseRenewed and acknowledging the lease.
Fixes
mormot.net.dhcp
2d2627f7+17-3
net: NAK requested address is not the one reserved
Impact
After an administrator moves a static reservation, a client presenting the former address is told to restart address acquisition rather than being ACKed with inconsistent state. Requests without option 50 and RENEWING through ciaddr intentionally retain the existing behavior.
Upgrade recommended
Upgrade through 2.4.16861 and test clients whose static reservation address may change while their previous lease is cached.
Units
2
High
Malformed DHCP address options no longer masquerade as IPv4 values
DhcpIP4 in mormot.net.dhcp initializes its TNetIP4 result to zero instead of the option offset. It only replaces zero when the option exists and its length byte equals SizeOf(TNetIP4). Regression tests send three-byte option 50 and 54 payloads and require normal ACK handling.
Fixes
mormot.net.dhcp
a86688a9+16-3
net: fixed DhcpIP4()
Impact
Malformed requested-address data no longer causes a false static-reservation conflict NAK, and malformed server-identifier data no longer makes this server drop the REQUEST as targeting another server. Correct four-byte options and absent options retain their existing meaning on Delphi and FPC.
Upgrade recommended
Do not deploy builds 2.4.16857–2.4.16859; move to 2.4.16861 and test malformed option 50 and 54 packets.
Public API
DhcpIP4behaviour-changed — Absent or non-four-byte options return zero instead of an option-buffer offset interpreted as IPv4.
Units
3
High
DHCP requests selecting another server are ignored
TDhcpProcess.LockedResponse in mormot.net.dhcp reads option 54 with DhcpIP4 before processing any dmtRequest lease. If the nonzero server identifier differs from TDhcpScope.ServerIdentifier, it exits through DoError with the new dsmDroppedOtherServer metric and trace reason.
Fixes
mormot.net.dhcp
6a6f94d3+15-2
net: new DHCP dsmDroppedOtherServer for REQUEST
Impact
In a network with multiple DHCP servers, this server no longer ACKs or NAKs a SELECTING client that chose another server. The new enum member shifts the numeric ordinals of later TDhcpScopeMetric values, so code or storage using raw metric ordinals or set bit positions should be reviewed.
Worth a look
Check multi-server REQUEST traces and search for persisted Ord(TDhcpScopeMetric) values or numeric TDhcpScopeMetrics masks.
Public API
TDhcpScopeMetric.dsmDroppedOtherServeradded — Counts REQUEST packets whose server-identifier selects another DHCP server.
Units
4
High
Short invalid numeric text no longer triggers a four-byte read
In the non-WIN32DELPHI GetExtended implementation in mormot.core.text, the non-digit path now checks P[1] and P[2] for NUL before reading PCardinal(P)^ to recognize NAN or INF. One- and two-character invalid tokens jump directly to the existing error path.
Fixes
mormot.core.text
0a750051+5-2
core: avoid potential read overflow in GetExtended()
Impact
FPC and non-Win32 Delphi services parsing a short invalid buffer avoid a potential read past the supplied NUL-terminated text, which could otherwise touch inaccessible memory. Valid numbers and the public signature are unchanged; Delphi Win32 keeps its separate x87 assembly parser.
Upgrade recommended
Upgrade if GetExtended receives externally supplied text, especially one- or two-character invalid values.
Units
5
Low
DHCP regression tests cover REQUEST state transitions
test.net.proto adds cases for matching and moved static reservations, INIT-REBOOT and SELECTING NAKs, RENEWING through ciaddr, offers after NAK, and static or dynamic REQUEST packets selecting another server. test.core.base also adds a GetExtended('0.0') regression assertion.
Tests
a0347464+73-3
tests: cover latest DHCP fixes
Impact
No application code or public API changes. The test matrix records which DHCP client states should be ignored, ACKed, NAKed or offered a reservation, reducing regression risk for Delphi and FPC server builds.
6
Low
DHCP malformed-option tests return inside the protected test body
test.net.proto moves the finally keyword below the malformed option 50 and 54 assertions. Those assertions now run in the try body, while server.Free and settings.Free remain in the finally block and execute even if a check raises.
Tests
d3ed9070+4-3
tests: fixed typo on previous commit
Impact
No application code or public API changes. A failing malformed-option assertion can no longer skip the intended test-resource cleanup, so the regression suite reports failures with safer cleanup on Delphi and FPC.