feat(core): DHCP in the simulation core, as in Swift
engine.ts ports Swift's "DHCP server and automatic client": an active server listens on port 67 from the start and offers a static assignment before its range, round from the address after the last one offered; offers last 10 s, dynamic leases a day, and a server whose offer another server beat blacklists that address for a while. A client starts as an event: DISCOVER, OFFER, a check by ARP, DECLINE, REQUEST, ACK or NAK, 2.5 s per wait, and after ten failures its old address back. The snapshot carries the DHCP settings of clients and servers. Four scenarios match the Swift engine. One Swift error is named in the oracle test: a client run directly is advanced a second time, to FINISH, by the server's answer within its own DISCOVER, and the outer run then writes back its stale copy of the status (Swift's value types); the address and every trace agree, only the reported status is wrong in Swift. Swift's three DHCP engine tests are ported, with tests for stopping and the message format. 15 mutation probes, 14 caught; the other concerns the home router, which runs only once NAT is ported. Two departures from Java remain, to be fixed next: from the event queue the client's ARP check does not wait, so an address conflict is never found, and each answer that wakes the client makes it send its state's message again (a second DISCOVER and REQUEST, the second answered with NAK). Java waits a round trip and sends once per attempt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -24,7 +24,11 @@ npm test # vergleicht mit den geschriebenen *.swift.json
|
||||
`closeSocket`; TCP: `openTcpServer`, `openTcpClient`, `connectTcp`
|
||||
(Ergebnis `connected`, `invalidSocket`, `unreachable`, `timedOut`),
|
||||
`sendTcp` (mit `repeatCount` für lange Nachrichten), `receiveTcp`,
|
||||
`acceptedTcp`, `peerTcp`, `cleanTcp`; `closeSocket` schließt auch TCP.
|
||||
`acceptedTcp`, `peerTcp`, `cleanTcp`; `closeSocket` schließt auch TCP;
|
||||
DHCP: `runDhcp` (Ergebnis der Client-Status). Szenarien können
|
||||
`dhcpServers` (Bereich, eigene Einstellungen, feste Zuordnungen) und
|
||||
`dhcpClients` angeben; das Ergebnis enthält die Gerätekonfiguration und
|
||||
den DHCP-Zustand (Clients, Leases, Angebote, Sperrliste, Server).
|
||||
Das Ergebnis enthält die Sockets mit der Länge ihrer Warteschlange, dem
|
||||
TCP-Zustand, dem annehmenden Socket und den Sitzungswerten.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user