feat(core): packet capture per card after Java's Lauscher, measured card by card
The engine keeps Java's packet capture (capture.ts): per network card every frame it sent (when it leaves on the cable) or received (also one for another card), once, with time and number; switches log nothing; frames the packet loss dropped are kept apart; the capture outlives a stop and a new start, as in Java, until clearCapture. Per port instead of per MAC, at most 10,000 frames a card. expectSameCaptures compares each card's capture with Java's list of that card in the ARP, WLAN, DNS, TCP, NAT, RIP and single-client DHCP runs. It found that ScenarioNetwork ignored a switch's learning time (Java ran 300 s, the core the scenarios' 5 s); the oracle sets it now, and the TCP and DHCP runs are recorded again. A core test found that a new start numbers frames from 1 again and the capture took them as seen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -446,3 +446,26 @@ liest nur die Oberfläche):
|
||||
Swift verbindet zur Laufzeit jeden Rechner mit eingeschaltetem WLAN mit
|
||||
einem freien Port des Switches seiner SSID, auch ohne Kabel
|
||||
(`wirelessAssociations`). Der Kern folgt Java: Er kennt nur die Kabel.
|
||||
|
||||
## Mitschnitt je Karte
|
||||
|
||||
Was `ScenarioNetwork.writeFrames` schreibt, ist Javas Mitschnitt selbst
|
||||
(`Lauscher.datenEinheiten`): je Karte jeder Frame, den sie gesendet oder
|
||||
empfangen hat. Seit F2.8a vergleicht der Kern seinen Mitschnitt Karte für
|
||||
Karte damit (`expectSameCaptures` in `packages/core/test/javaRun.ts`), nicht
|
||||
mehr nur jeden Frame dort, wo er zuerst auftaucht.
|
||||
|
||||
Dabei fiel auf (01.10.2026): `ScenarioNetwork` übernahm die Lernzeit eines
|
||||
Switches (`switches.<id>.retention`) nicht; Java lief mit 300 s, der Kern
|
||||
mit den 5 s der Szenarien `tcp-lan` und `dhcp-*`. Der alte Vergleich sah den
|
||||
Unterschied nicht: Ein gefluteter Frame erscheint nur auf zusätzlichen
|
||||
Karten. Seit F2.8a setzt das Werkzeug die Lernzeit
|
||||
(`SwitchFirmware.setRetentionTime`), die TCP- und DHCP-Läufe sind neu
|
||||
aufgenommen. Mit 5 s flutet auch Javas Switch in `lostData` den FIN nach
|
||||
26 s an alle Karten, wie der Kern. `dhcp-lan` behält die alte Aufnahme: Die
|
||||
neue unterscheidet sich nur darin, welcher der beiden Clients zuerst sendet;
|
||||
nach 5 s gehen dort nur noch Broadcasts.
|
||||
|
||||
Javas Switch prüft seine Tabelle einmal je Sekunde ab dem Start
|
||||
(`SwitchFirmware.checkSAT`), ein Eintrag verfällt also bis zu einer Sekunde
|
||||
nach der Lernzeit; der Kern genau bei ihr. Noch nicht gemessen.
|
||||
|
||||
@@ -144,10 +144,14 @@ public class ScenarioNetwork {
|
||||
cable.setAnschluesse(new Port[] { ports.get(link.get("sourcePort")), ports.get(link.get("targetPort")) });
|
||||
cable.setWireless(Boolean.TRUE.equals(link.get("wireless")));
|
||||
}
|
||||
// A switch's SSID, a host's wireless card and the SSID it joins: what the
|
||||
// editor reads to lay a wireless cable; the simulation does not ask.
|
||||
// A switch's SSID and learning time; a host's wireless card and the SSID
|
||||
// it joins. The SSIDs only the editor reads, to lay a wireless cable.
|
||||
for (Map.Entry<String, Object> entry : map(scenario.getOrDefault("switches", new HashMap<>())).entrySet()) {
|
||||
((SwitchFirmware) nodes.get(entry.getKey()).getSystemSoftware()).setSSID((String) map(entry.getValue()).get("ssid"));
|
||||
Map<String, Object> config = map(entry.getValue());
|
||||
SwitchFirmware firmware = (SwitchFirmware) nodes.get(entry.getKey()).getSystemSoftware();
|
||||
firmware.setSSID((String) config.get("ssid"));
|
||||
// How long the switch keeps a learned MAC address (Java's default 300 s).
|
||||
if (config.containsKey("retention")) firmware.setRetentionTime(((Number) config.get("retention")).longValue());
|
||||
}
|
||||
for (Map.Entry<String, Object> entry : map(scenario.getOrDefault("wireless", new HashMap<>())).entrySet()) {
|
||||
Betriebssystem os = (Betriebssystem) system(nodes.get(entry.getKey()));
|
||||
|
||||
Reference in New Issue
Block a user