feat(core): the firewall settings page of routers after Java, measured against Java
The page konfig changes the firewall at run time (into the snapshot, back into the project through projectWithSimulationChanges). KonfigCases feeds Java's plug-in directly (25 cases, de and en); RouterWebRun plays two stories over the network. Ten Java bugs named, not adopted. The web server answers a method not written GET or POST with 501, as Java does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,9 @@
|
||||
// not compared. Java's router server sometimes never listens (setAktiv wakes
|
||||
// its thread only when it already waits), and takes no initial sequence
|
||||
// number then; the engine's always listens: sequence numbers are compared
|
||||
// below the millions. The settings page (konfig) comes with F3.2c.
|
||||
// below the millions. The settings page (konfig) changes the firewall at run
|
||||
// time: a ping passes once "drop ICMP" is saved off; a rule moved above the
|
||||
// one that accepts the browser shuts it out.
|
||||
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { dirname, join } from 'node:path';
|
||||
@@ -46,15 +48,53 @@ const open =
|
||||
engine.webBrowser(browser)!.open(typed);
|
||||
};
|
||||
|
||||
const post =
|
||||
(typed: string, data: string) =>
|
||||
(engine: NetworkRuntimeEngine, browser: string): void => {
|
||||
engine.webBrowser(browser)!.open(typed, data);
|
||||
};
|
||||
|
||||
const ping = (engine: NetworkRuntimeEngine, browser: string): void => {
|
||||
engine.sendIcmpEcho(browser, '20.0.0.2', { sequenceNumber: 1 });
|
||||
};
|
||||
|
||||
/** The form as Java's browser window posts it: every field, then the button pressed. */
|
||||
const FORM = {
|
||||
saveWithoutIcmp: 'firewallActivate=1&onlySYN=1&btnSave=speichern&defaultPolicy=accept&srcIP=&srcMask=&destIP=&destMask=&protocol=*&port=&action=drop',
|
||||
addTcpDrop: 'firewallActivate=1&dropICMP=1&onlySYN=1&defaultPolicy=accept&srcIP=&srcMask=&destIP=&destMask=&protocol=TCP&port=80&action=drop&addrule=hinzuf%C3%BCgen',
|
||||
moveSecondUp: 'firewallActivate=1&dropICMP=1&onlySYN=1&defaultPolicy=accept&radioRule=2&moveup=rauf&srcIP=&srcMask=&destIP=&destMask=&protocol=*&port=&action=drop',
|
||||
};
|
||||
|
||||
const STORIES: Record<string, Story> = {
|
||||
routerIndex: { scenario: 'router-web', browser: id(301), router: id(302), acts: [[500, open('10.0.0.1')]] },
|
||||
routerRoutes: { scenario: 'router-web', browser: id(301), router: id(302), acts: [[500, open('10.0.0.1/routes')]] },
|
||||
routerKonfig: { scenario: 'router-web', browser: id(301), router: id(302), acts: [[500, open('10.0.0.1/konfig')]] },
|
||||
konfigIcmp: {
|
||||
scenario: 'router-web',
|
||||
browser: id(301),
|
||||
router: id(302),
|
||||
acts: [
|
||||
[500, ping],
|
||||
[3500, post('10.0.0.1/konfig', FORM.saveWithoutIcmp)],
|
||||
[7000, ping],
|
||||
],
|
||||
},
|
||||
konfigBlock: {
|
||||
scenario: 'router-web',
|
||||
browser: id(301),
|
||||
router: id(302),
|
||||
acts: [
|
||||
[500, post('10.0.0.1/konfig', FORM.addTcpDrop)],
|
||||
[4000, post('10.0.0.1/konfig', FORM.moveSecondUp)],
|
||||
[8000, open('10.0.0.1')],
|
||||
],
|
||||
},
|
||||
routerLog: {
|
||||
scenario: 'router-web',
|
||||
browser: id(301),
|
||||
router: id(302),
|
||||
acts: [
|
||||
[500, (engine, browser) => engine.sendIcmpEcho(browser, '20.0.0.2', { sequenceNumber: 1 })],
|
||||
[500, ping],
|
||||
[3500, open('10.0.0.1')],
|
||||
[7000, open('10.0.0.1/log')],
|
||||
],
|
||||
@@ -78,12 +118,21 @@ const withoutInitialNumbers = (text: string) =>
|
||||
.replace(/(seq|ack)=(\d+)/g, (_, name: string, value: string) => `${name}=${Number(value) % 1_000_000}`)
|
||||
.replace(/(SEQ|ACK): \d+\.(\d{3}\.\d{3})/g, '$1: n.$2');
|
||||
|
||||
/** Java's wait for a SYN's answer (TCPSocket: three times 2.75 s, its timeout here). */
|
||||
const JAVA_TIMEOUT_MILLISECONDS = 3 * 2_750;
|
||||
|
||||
/**
|
||||
* Where Java errs: its run corrected, as Java means it. routerLog: the
|
||||
* German log page closes its title with </titel> (sw_firewallweblog_msg1);
|
||||
* the engine writes </title>.
|
||||
* the engine writes </title>. konfigBlock: the browser's SYN, dropped by the
|
||||
* firewall, goes once in Java, not three times (webJava.test.ts, noServer);
|
||||
* the page "server not reachable" comes two attempts later in the engine.
|
||||
*/
|
||||
const JAVA_BUGS: Record<string, (java: JavaRun) => JavaRun> = {
|
||||
konfigBlock: (java) => ({
|
||||
...java,
|
||||
events: java.events.map(([time, who, text]) => (who === 'browser' && text.startsWith('page 0') ? [time + 2 * JAVA_TIMEOUT_MILLISECONDS, who, text] : [time, who, text])),
|
||||
}),
|
||||
routerLog: (java) => {
|
||||
const fixed = (text: string | null) => text?.replace('</titel>', '</title>') ?? null;
|
||||
const rows = (byCard: Record<string, (string | null)[][]> | undefined) =>
|
||||
@@ -103,6 +152,11 @@ const PAGE_PLACEHOLDERS: Record<string, (text: string) => string> = {
|
||||
ripRoutes: (text) => text.replace(/<td>-?\d+<\/td>(<td>[\d.]+<\/td><td><a )/g, '<td>validity</td>$1'),
|
||||
};
|
||||
|
||||
/** Where the frames are compared only up to a time (Java's). konfigBlock: the engine's second SYN, which Java does not send. */
|
||||
const UNTIL: Record<string, (java: JavaRun) => number> = {
|
||||
konfigBlock: (java) => java.events.find(([, who, text]) => who === 'browser' && text.startsWith('page 0'))![0] - 250,
|
||||
};
|
||||
|
||||
type Lines = Record<Program, [number, string][]>;
|
||||
|
||||
function javaLines(java: JavaRun): Lines {
|
||||
@@ -162,6 +216,7 @@ describe('the pages of routers and home routers as Java FILIUS serves them', ()
|
||||
cell: (text) => placeholders(withoutInitialNumbers(text)),
|
||||
tables: java,
|
||||
from: firstCall,
|
||||
until: UNTIL[name]?.(measured),
|
||||
starts: { java: 0, engine: 0 },
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user