From 72f4bb54f3c0f4be67d5d8e19fcc42f3d9b7575f Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Thu, 5 Nov 2026 02:09:52 +0000 Subject: [PATCH] Scrubbed clean traffic no longer shows as DDoS junk on links (#289) What a scrubbing center sends back to its target is the target's own traffic, but compute() carried it under the junk bucket, so a small flood at a big customer showed up as hundreds of gigabits of DDoS junk on the backbone. It now has its own bucket, shown as scrubbed clean traffic in the link panel. --- CHANGELOG.md | 1 + site/i18n/de.js | 1 + site/i18n/es.js | 1 + site/i18n/fr.js | 1 + site/i18n/it.js | 1 + site/i18n/pt.js | 1 + src/game/80-simulation/30-compute.js | 11 +++++---- src/game/93-ui/70-link-panels.js | 2 +- src/i18n/en.js | 1 + tests/ddos-scrub-clean.test.js | 36 ++++++++++++++++++++++++++++ 10 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 tests/ddos-scrub-clean.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index b10e1f4..52c0c25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ All notable changes to this project are documented here. The project follows - The NOC charts have tooltips, on the dashboard and on the wallboard in the NOC window: hover (or touch) a chart to see every series on that day, with a total. Click an entry in the legend to hide or show that series, and the scale follows what is left. The "how it arrives" bars on the Traffic tab show the same kind of tooltip, and its legend picks which ways in (caches, PNIs, IX peering, transit) the table counts. - Bilbao joins the map, where the transatlantic cables really come ashore: Marea Carey, Grace Hopscotch and Sol Survivor now land there instead of Madrid. It has no exchange of its own, so traffic heads inland to Madrid, and Drizzle Electric, Tangerine Telecom and the big carriers sell transit there. A link you already run on the old Madrid landings keeps working as a plain subsea link, and the Mid-Atlantic Accent scenario now goes Azores, Bilbao, Madrid, and Marea Carey now leaves the American coast at Virginia Beach instead of crossing the northeast to New Jersey. Columbus III-and-a-half now comes ashore near Cádiz, where it really landed, on its way to Madrid. - Puzzles are easier to read, above all on phones: the three stars are now three goals in plain words, and the one you are working on says what is wrong and what to do, with a Show me button. The map marks it too: a red ring around a city that still needs traffic, and a pulsing ✂ on a link whose cut would hurt. On phones the sheet starts small so the map gets the screen; swipe it up for the rest. Cities far from the puzzle are left off the map, and stepping stones you are not using are small dots without a name until you tap one, build there or zoom in. +- Clean traffic that a scrubbing center sends back to a customer under attack no longer shows as DDoS junk on your backbone links; a link now lists it as scrubbed clean traffic, so a small flood no longer looks like hundreds of gigabits of junk (#289). ## [2.9.1] — 2026-11-04 - Jokes in the game now poke fun at networks, cables and routers, never at people, countries or beliefs. A few networks have new names (Atlas Hold-the-Line Telecom, Star-Blink, Telekom Malay-tency, Oh Yas Sénégal, Afghan Tele-Pass, Island-Hop Micronesia, Tel-One-derful, Tango Two-Step), so do three of the names for your own cables, and about forty descriptions of networks, cities, cables and events were rewritten. diff --git a/site/i18n/de.js b/site/i18n/de.js index 3ffe669..28039ea 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -1498,6 +1498,7 @@ "common.scenario_specialist":"Szenario-Spezialist", "common.scenarios":"Szenarien", "common.script_kiddie":"Script Kiddie", +"common.scrubbed_traffic":"Sauberer Traffic vom Scrubbing", "common.scrubbing_centers":"Scrubbing-Center", "common.see_who":"Wer?", "common.selective":"Selektiv", diff --git a/site/i18n/es.js b/site/i18n/es.js index e90856f..d03e88d 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -1496,6 +1496,7 @@ "common.scenario_specialist":"Especialista en escenarios", "common.scenarios":"Escenarios", "common.script_kiddie":"Script kiddie", +"common.scrubbed_traffic":"Tráfico limpio del scrubbing", "common.scrubbing_centers":"Centros de depuración", "common.see_who":"Ver quién", "common.selective":"Selectiva", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index 2c7461a..5d93c0c 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -1496,6 +1496,7 @@ "common.scenario_specialist":"Spécialiste des scénarios", "common.scenarios":"Scénarios", "common.script_kiddie":"Script kiddie", +"common.scrubbed_traffic":"Trafic nettoyé par le scrubbing", "common.scrubbing_centers":"Centres de scrubbing", "common.see_who":"Voir qui", "common.selective":"Sélective", diff --git a/site/i18n/it.js b/site/i18n/it.js index 3381ff8..59a264d 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -1496,6 +1496,7 @@ "common.scenario_specialist":"Specialista di scenari", "common.scenarios":"Scenari", "common.script_kiddie":"Script Kiddie", +"common.scrubbed_traffic":"Traffico pulito dallo scrubbing", "common.scrubbing_centers":"Centri di scrubbing", "common.see_who":"Vedi chi", "common.selective":"Selettiva", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index e021902..eda0475 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -1496,6 +1496,7 @@ "common.scenario_specialist":"Especialista em cenários", "common.scenarios":"Cenários", "common.script_kiddie":"Script Kiddie", +"common.scrubbed_traffic":"Tráfego limpo do scrubbing", "common.scrubbing_centers":"Centros de scrubbing", "common.see_who":"Ver quem", "common.selective":"Seletiva", diff --git a/src/game/80-simulation/30-compute.js b/src/game/80-simulation/30-compute.js index 5353c91..d414a57 100644 --- a/src/game/80-simulation/30-compute.js +++ b/src/game/80-simulation/30-compute.js @@ -13,7 +13,7 @@ class EgSums{constructor(t){this.t=t;}get(k){const s=this.t.g.get(k);return s=== threads, so it sends these plain pieces (R.efp, R.flc) and the page rebuilds the same lazy R. */ function efBuild(R2,L,ACN,ACD,NKN,NC,NN){const efg={};for(const [id,i,t] of L){let rec=null;efg[id]=new EgSums(t); Object.defineProperty(R2.ef,id,{enumerable:true,configurable:true,get(){if(!rec){rec={eg:{},net:{},dst:{}};for(const [k,s] of t.g)rec.eg[k]=t.v[s]; - for(const j of t.n)rec.net[j=1;if(CORE)for(const c of pops){const i=CIDX[c];PASS[i]=corePass(c);OUT[i]=inCore(c)?0:1;} const nodeTake=(i,a)=>{NRES[i]-=a;if(!NSEEN[i]){NSEEN[i]=1;NORD.push(i);}NLOAD[i]=(NLOAD[i]||0)+a;}; const TNA=new Float64Array(TSL.size*NN),TNS=new Uint8Array(TSL.size*NN),TNK=[],TORD=[]; - const NKN=NN+2,ACN=new Float64Array(NE*NKN),SEN=new Uint8Array(NE*NKN),ACD=new Float64Array(NE*NC),SED=new Uint8Array(NE*NC),EL=[]; + const NKN=NN+3,ACN=new Float64Array(NE*NKN),SEN=new Uint8Array(NE*NKN),ACD=new Float64Array(NE*NC),SED=new Uint8Array(NE*NC),EL=[]; // t.g gives each egress a slot in t.v, so adding to it allocates nothing (a Map of numbers boxes every new sum). const carry=(l,eg,nr,ci,a)=>{let t=l.tr;if(!t){t=l.tr={g:new Map(),v:[],n:[],d:[]};EL.push(l);}const s=t.g.get(eg);if(s===undefined){t.g.set(eg,t.v.length);t.v.push(0+a);}else t.v[s]+=a; let k=l.i*NKN+nr;if(!SEN[k]){SEN[k]=1;t.n.push(nr);}ACN[k]=(ACN[k]||0)+a;k=l.i*NC+ci;if(!SED[k]){SED[k]=1;t.d.push(ci);}ACD[k]=(ACD[k]||0)+a;}; @@ -172,12 +172,13 @@ function compute(){RW.gen++; // Same answer as diversePaths(), which would rebuild today's live links for every customer. if((b.reqs||[]).includes('diverse')){const k=b.city+'>'+b.city2;R2.div[b.id]=divMemo[k]??(divMemo[k]=disjointI(b.city,b.city2));}}})(); /* Floods ride the backbone ahead of everyone's traffic (25-ddos-flood.js). haul: up to g from city A to POP B over the - shortest path, as far as links and routers have room. */ + shortest path, as far as links and routers have room. What a scrubbing center sends back is the target's own clean + traffic, counted apart from the junk (#289). */ const msOf=(A,B)=>{const Bi=CIDX[B],Ai=CIDX[A];return SPD[B]&&SPD[B][Ai]n+e.lat,0):0;}; let JK=0;const haul=(A,B,g,ek,from,clean)=>{if(!(g>0))return 0;const Ai=CIDX[A],Bi=CIDX[B];if(!SPD[B]||!(SPD[B][Ai]{const key=src*NC+dst,c0=teCache.get(key); diff --git a/src/game/93-ui/70-link-panels.js b/src/game/93-ui/70-link-panels.js index 8fcd742..4e488d9 100644 --- a/src/game/93-ui/70-link-panels.js +++ b/src/game/93-ui/70-link-panels.js @@ -61,7 +61,7 @@ function trafficSection(l){ if(!rec){return h+`

${tr('link_panels.no_traffic_right_now')}

`;} const tot=Object.values(rec.net).reduce((a,b)=>a+b,0)||1; const nets=Object.entries(rec.net).sort((a,b)=>b[1]-a[1]); - const col=id=>id==='junk'?'#FF4D5E':id==='l2vpn'?'#7B61FF':NET[id].col,nm=id=>id==='junk'?tr('common.ddos_junk'):id==='l2vpn'?tr('common.l2vpn_customers'):NET[id].name; + const col=id=>id==='junk'?'#FF4D5E':id==='l2vpn'?'#7B61FF':id==='scrub'?'#22C47A':NET[id].col,nm=id=>id==='junk'?tr('common.ddos_junk'):id==='l2vpn'?tr('common.l2vpn_customers'):id==='scrub'?tr('common.scrubbed_traffic'):NET[id].name; h+=`${n>1?`

${tr('link_panels.totals_for_all_n_links_between',{n})}

`:''}
${nets.map(([id,v])=>``).join('')}
`; h+=`

${tr('common.content_from')}

`+nets.slice(0,6).map(([id,v])=>`
${esc(nm(id))}${fmtG(v)} · ${pct(v/tot)}
`).join(''); const egs=Object.entries(rec.eg).sort((a,b)=>b[1]-a[1]); diff --git a/src/i18n/en.js b/src/i18n/en.js index 0c5865c..d0eedb7 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -1497,6 +1497,7 @@ "common.scenario_specialist":"Scenario Specialist", "common.scenarios":"Scenarios", "common.script_kiddie":"Script Kiddie", +"common.scrubbed_traffic":"Scrubbed clean traffic", "common.scrubbing_centers":"Scrubbing centers", "common.see_who":"See who", "common.selective":"Selective", diff --git a/tests/ddos-scrub-clean.test.js b/tests/ddos-scrub-clean.test.js new file mode 100644 index 0000000..a226100 --- /dev/null +++ b/tests/ddos-scrub-clean.test.js @@ -0,0 +1,36 @@ +// #289: the clean traffic a scrubbing center sends back to its target is the target's own traffic, not the flood. +// On a link it must not show as DDoS junk, which made a 12 G attack look like hundreds of gigs of junk on the backbone. +const test = require('node:test'); +const assert = require('node:assert/strict'); +const { load } = require('./harness'); + +test('#289 scrubbed traffic coming back to the target is not counted as DDoS junk on the backbone', () => { + const { ev, errors } = load(); + ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.cash=1e9;S.lvl=4;S.nextFail=1e9;S.nextEvent=1e9;ACT.launchBB({city:'fra'});S.pops.fra.bb.d=40;ACT.buyTransit({city:'fra',net:'cog',tier:1})"); + ev("ACT.buildPop({city:'ams'});UI.pending={a:'fra',b:'ams'};ACT.buildLink({tier:1});closeModal()"); + // A big customer (200 G port) hit by a small 12 G flood, with a 10T scrubbing center in Amsterdam always on. + ev("S.biz.push({id:'h',type:'host',name:'Big Host',city:'fra',bw:200,rate:100,mood:80,since:0,reqs:[]});S.scrubs=[{city:'ams',tier:2}];S.scrubMode='always'"); + ev("S.ev.ddos={id:'atk',city:'fra',tgt:'h',vec:'dns',gbps:12,start:S.day,until:S.day+2,bh:false};compute()"); + const m = JSON.parse(ev("(()=>{const m=ddosReport(ddosAll()[0]);return JSON.stringify({pulled:m.pulled,cleaned:m.cleaned,over:m.over})})()")); + assert.equal(m.pulled, 12, 'the whole flood is pulled to the scrubbing center'); + assert.equal(m.over, 0, 'and cleaned in full'); + const net = JSON.parse(ev("JSON.stringify(R.ef[edgeKey(S.links.find(l=>l.a==='fra'&&l.b==='ams'||l.a==='ams'&&l.b==='fra'))].net)")); + assert.ok(!(net.junk > 1e-6), `no junk on the link: ${JSON.stringify(net)}`); + assert.ok(net.scrub > 50, `the clean traffic is shown as such: ${JSON.stringify(net)}`); + const h = ev("trafficSection(S.links.find(l=>l.a==='fra'&&l.b==='ams'||l.a==='ams'&&l.b==='fra'))"); + assert.doesNotMatch(h, /DDoS junk/); + assert.match(h, new RegExp(ev("tr('common.scrubbed_traffic')"))); + assert.deepEqual(errors, []); +}); + +test('#289 a flood that does ride the backbone is still DDoS junk', () => { + const { ev, errors } = load(); + ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.cash=1e9;S.lvl=4;S.nextFail=1e9;S.nextEvent=1e9;ACT.launchBB({city:'fra'});S.pops.fra.bb.d=40"); + ev("ACT.buildPop({city:'ams'});UI.pending={a:'fra',b:'ams'};ACT.buildLink({tier:1});closeModal();ACT.buyTransit({city:'ams',net:'cog',tier:1})"); + ev("S.biz.push({id:'g',type:'game',name:'Lag Lords',city:'fra',bw:10,rate:100,mood:80,since:0,reqs:[]})"); + ev("S.ev.ddos={id:'atk',city:'fra',tgt:'g',vec:'ack',gbps:20,start:S.day,until:S.day+2,bh:false};compute()"); + const net = JSON.parse(ev("JSON.stringify(R.ef[edgeKey(S.links.find(l=>l.a==='fra'&&l.b==='ams'||l.a==='ams'&&l.b==='fra'))].net)")); + assert.ok(net.junk > 1, `junk on the link: ${JSON.stringify(net)}`); + assert.ok(!(net.scrub > 0)); + assert.deepEqual(errors, []); +});