Merge pull request #290 from fjaeckel/claude/fix-289
Scrubbed clean traffic no longer shows as DDoS junk on links (#289)
This commit is contained in:
commit
28e732448e
10 changed files with 50 additions and 6 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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<NN?NETS[j].id:j===NN?'junk':'l2vpn']=ACN[i*NKN+j];for(const ci of t.d)rec.dst[CITIES[ci].id]=ACD[i*NC+ci];}return rec;}});}
|
||||
for(const j of t.n)rec.net[j<NN?NETS[j].id:j===NN?'junk':j===NN+1?'l2vpn':'scrub']=ACN[i*NKN+j];for(const ci of t.d)rec.dst[CITIES[ci].id]=ACD[i*NC+ci];}return rec;}});}
|
||||
Object.defineProperty(R2,'efg',{value:efg});Object.defineProperty(R2,'efp',{value:{L,ACN,ACD,NKN,NC,NN}});}
|
||||
// R.fl: the flows as objects, made only when something asks (38-pni-value.js). E: the exits FTI and FII point into.
|
||||
function flDefine(R2,c){const {NF,FREM,FCI,FNJ,FCA,FBZ,FGT,FGI,FGP,FGH,FTI,FII,E,CNB,NCN}=c;let fl=null;Object.defineProperty(R2,'flc',{value:c});
|
||||
|
|
@ -117,14 +117,14 @@ function compute(){RW.gen++;
|
|||
FGT=new Float64Array(NF),FGI=new Float64Array(NF),FGP=new Float64Array(NF),FGH=new Float64Array(NF),FTI=new Int32Array(NF).fill(-1),FII=new Int32Array(NF).fill(-1);
|
||||
/* While routing, each edge keeps its own room (res) and load (ld). Routers only exist in POPs (HAS): their room,
|
||||
load and served traffic are kept per city index. What crosses each edge (R.ef) is added up by egress, and in
|
||||
arrays by network (then 'junk' and 'l2vpn') and by source city, each key in the order it first got traffic. */
|
||||
arrays by network (then 'junk', 'l2vpn' and 'scrub') and by source city, each key in the order it first got traffic. */
|
||||
const LATP=new Float64Array(NC),FARL=[],NRES=new Float64Array(NC),HAS=new Uint8Array(NC),NLOAD=new Float64Array(NC),NSEEN=new Uint8Array(NC),NORD=[],SRV=new Float64Array(NC),PASS=new Float64Array(NC).fill(1),OUT=new Uint8Array(NC);
|
||||
for(const k in edges)edges[k].res=edges[k].cap;for(const c of pops){const i=CIDX[c];NRES[i]=nodeCap(c);HAS[i]=1;R2.nodeCap[c]=NRES[i];}
|
||||
// The core (backbone technology): what passing-through traffic costs each router, and which POPs TE must avoid.
|
||||
const CORE=coreOn()&&S.core.run>=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]<Infinity?walkI(SPP[B],Bi,Ai).path.reduce((n,e)=>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]<Infinity))return 0;
|
||||
const {path,ni}=walkI(SPP[B],Bi,Ai);let amt=g;for(const l of path)amt=Math.min(amt,l.res);for(const i of ni)if(HAS[i])amt=Math.min(amt,NRES[i]);amt=Math.max(0,amt);if(amt<=1e-9)return 0;
|
||||
if(!R2.egDesc[ek])R2.egDesc[ek]={lab:clean?labOf(N_('compute.scrubbed_traffic_from_city'),'city',CITY[A].name):labOf(N_('compute.attack_entering_in_city'),'city',CITY[from].name),city:B,k:'l2'};
|
||||
for(const i of ni)if(HAS[i])nodeTake(i,amt);for(const l of path){l.res-=amt;l.ld+=amt;if(!clean){l.jk=(l.jk||0)+amt;JK=1;}carry(l,ek,NN,Bi,amt);}return amt;};
|
||||
for(const i of ni)if(HAS[i])nodeTake(i,amt);for(const l of path){l.res-=amt;l.ld+=amt;if(!clean){l.jk=(l.jk||0)+amt;JK=1;}carry(l,ek,clean?NN+2:NN,Bi,amt);}return amt;};
|
||||
const DD=ddosLoad({E,okBy,R2,autoBh:!!(TRX&&TRX.blackhole),haul,ms:msOf});
|
||||
const TE=!!(S.te&&S.te.on)&&coreTE(),TR=TE?teRules():null,REACH=coreTeReach();R2.teMoved=0;const teCache=new Map(),SPILL=TR&&TR.spill?TR.spill:1;
|
||||
const altPath=(src,dst,base)=>{const key=src*NC+dst,c0=teCache.get(key);
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ function trafficSection(l){
|
|||
if(!rec){return h+`<p class="empty">${tr('link_panels.no_traffic_right_now')}</p></section>`;}
|
||||
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?`<p class="note" style="margin-top:0">${tr('link_panels.totals_for_all_n_links_between',{n})}</p>`:''}<div class="stack">${nets.map(([id,v])=>`<i style="width:${v/tot*100}%;background:${col(id)}" title="${esc(nm(id))}"></i>`).join('')}</div>`;
|
||||
h+=`<h4 class="sub4">${tr('common.content_from')}</h4>`+nets.slice(0,6).map(([id,v])=>`<div class="kv"><span><span class="dot" style="background:${col(id)}"></span>${esc(nm(id))}</span><b>${fmtG(v)} · ${pct(v/tot)}</b></div>`).join('');
|
||||
const egs=Object.entries(rec.eg).sort((a,b)=>b[1]-a[1]);
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
36
tests/ddos-scrub-clean.test.js
Normal file
36
tests/ddos-scrub-clean.test.js
Normal file
|
|
@ -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, []);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue