From bd4f650f5e02f788fd1d568b035a5cad3ab1dd71 Mon Sep 17 00:00:00 2001 From: "C. Guy Yarvin" Date: Tue, 16 May 2017 13:56:54 -0700 Subject: [PATCH 1/2] |nuke bounces all packets from a ship. --- app/hood.hoon | 1 + arvo/ames.hoon | 28 +++++++++++++---- arvo/gall.hoon | 77 +++++++++++++++++++++++++++++++++++----------- arvo/zuse.hoon | 12 +++++++- gen/hood/nuke.hoon | 13 ++++++++ lib/helm.hoon | 8 +++++ 6 files changed, 114 insertions(+), 25 deletions(-) create mode 100644 gen/hood/nuke.hoon diff --git a/app/hood.hoon b/app/hood.hoon index a2d0b475fd..7d23daa211 100644 --- a/app/hood.hoon +++ b/app/hood.hoon @@ -141,6 +141,7 @@ ++ poke-helm-send-hi (wrap poke-send-hi):from-helm ++ poke-helm-send-ask (wrap poke-send-ask):from-helm ++ poke-helm-verb (wrap poke-verb):from-helm +++ poke-helm-nuke (wrap poke-nuke):from-helm ++ poke-helm-begin (wrap poke-begin):from-helm ++ poke-hood-sync (wrap poke-sync):from-kiln ++ poke-hood-init-sync (wrap poke-init-sync):from-kiln diff --git a/arvo/ames.hoon b/arvo/ames.hoon index 02d3c2952c..bbbd8b36c1 100644 --- a/arvo/ames.hoon +++ b/arvo/ames.hoon @@ -378,7 +378,7 @@ 0w0 :: 233, ~dyn, Tlon 0w0 :: 234, ~dem, Tlon 0w0 :: 235, ~lux, Tlon Investor 15 - 0w1O.Jq9xt.YFg7U.qg13U.WFNGJ :: 236, ~fed, Iceman + 0w0 :: 236, ~fed, Tlon 0w0 :: 237, ~sed, Tlon 0w0 :: 238, ~bec, Tlon 0w0 :: 239, ~mun, Tlon @@ -917,8 +917,8 @@ =: caw 2 rto ;: min (mul 2 rto) - ~m15 - (mul ~m1 ?~(rue 1 +((div (sub now u.rue) ~d1)))) + ~m2 + (mul ~s16 ?~(rue 1 +((div (sub now u.rue) ~d1)))) == == (harv now) @@ -1182,6 +1182,9 @@ |% ++ apse ^+ +>.$ + ?: =(%dead kay) + ~& [%dead-ack source+her packet+`@p`(mug dam)] + cock =+ oub=bust:puz =+ neg==(~ yed.caq.dur.diz) =. +>.$ east @@ -1594,10 +1597,15 @@ (hunt doz rtn.sop.bah) :: ++ load - |= old/fort - ^+ ..^$ + |= old/?(fort furt) ~& %ames-reload - ..^$(fox old) + %_ ..^$ + fox + ?- -.old + $0 [%1 gad.old hop.old ~ ton.old zac.old] + $1 old + == + == :: ++ scry |= {fur/(unit (set monk)) ren/@tas who/ship syd/desk lot/coin tyl/path} @@ -1810,6 +1818,14 @@ :: $sith (~(czar am [now fox]) p.kyz q.kyz r.kyz) + :: + $nuke + :- ~ + ?: (~(has in bad.fox) p.kyz) + ~& [%unblock p.kyz] + fox(bad (~(del in bad.fox) p.kyz)) + ~& [%block p.kyz] + fox(bad (~(put in bad.fox) p.kyz)) :: $wake (~(wake am [now fox]) hen) diff --git a/arvo/gall.hoon b/arvo/gall.hoon index d073e9568c..ce98e40767 100644 --- a/arvo/gall.hoon +++ b/arvo/gall.hoon @@ -13,7 +13,6 @@ == :: ++ rook :: forward ames msg $% {$m p/mark q/*} :: message - {$l p/mark q/path} :: "peel" subscribe {$s p/path} :: subscribe {$u $~} :: cancel+unsubscribe == :: @@ -59,7 +58,7 @@ qel/(map bone @ud) :: queue meter == :: ++ mast :: ship state - $: mak/* :: (deprecated) + $: mak/(unit duct) :: ames awaiting crash sys/duct :: system duct sap/(map ship scad) :: foreign contacts bum/(map dude seat) :: running agents @@ -252,11 +251,11 @@ =^ num +>.$ (mo-bale him) =+ ^= roc ^- rook ?- -.q.caz + $peel !! $poke [%m p.p.q.caz q.q.p.q.caz] $pull [%u ~] $puff !! $punk !! - $peel [%l p.q.caz q.q.caz] $peer [%s p.q.caz] == %+ mo-pass @@ -275,12 +274,11 @@ `[[%leaf (trip p.u.ars)] q.u.ars] :: ++ mo-awed :: foreign response - |= {him/ship why/?($peer $peel $poke $pull) art/(unit ares)} + |= {him/ship why/?($peer $poke $pull) art/(unit ares)} ^+ +> :: ~& [%mo-awed him why art] =+ tug=(mo-baba (mo-baal art)) ?- why - $peel (mo-give %unto %reap tug) $peer (mo-give %unto %reap tug) $poke (mo-give %unto %coup tug) $pull +>.$ @@ -408,6 +406,7 @@ $coup (mo-give %mack p.cuf) $diff %+ mo-pass [%sys %red t.pax] [%a %wont [our him] [%g %gh dap ~] [num %d p.p.cuf q.q.p.cuf]] + $doff !! $quit %+ mo-pass [%sys pax] [%a %wont [our him] [%g %gh dap ~] [num %x ~]] $reap (mo-give %mack p.cuf) @@ -429,14 +428,14 @@ ?> ?=({@ $~} t.pax) %- mo-awed :* p.+>.sih - ;;(?($peer $peel $poke $pull) i.t.pax) + (?($peer $poke $pull) i.t.pax) ~ == ?> ?=({$a $woot *} sih) ?> ?=({@ $~} t.pax) %- mo-awed :* p.+>.sih - ;;(?($peer $peel $poke $pull) i.t.pax) + (?($peer $poke $pull) i.t.pax) +>+.sih == == @@ -459,10 +458,42 @@ +>.$ ap-abet:(ap-purr:pap +<.q.hin t.t.t.pax +>.q.hin) :: - $out ?. ?=({$g $unto *} q.hin) + $out ?: ?=({$f $made *} q.hin) + ?- -.q.+>.q.hin + $tabl ~|(%made-tabl !!) + $& =. ap.pap (mo-resume-mack:pap ~) + ap-abet:(ap-pout:pap t.t.t.pax %diff +.q.+>.q.hin) + $| + =+ why=p.q.+>.q.hin + =. ..ap ap-abet:(ap-misvale:pap t.pax) + =. why (turn why |=(a/tank rose+[~ "! " ~]^[a]~)) + ~> %slog.`rose+[" " "[" "]"]^[>%mo-cook-fail< (flop why)] + ~& [him=q.q.pry our=our pax=pax] + :: + :: here we should crash because the right thing + :: for the client to do is to upgrade so that it + :: understands the server's mark, thus allowing + :: the message to proceed. but ames is not quite + :: ready for promiscuous crashes, so instead we + :: send a pull outward and a quit downward. + :: or not... outgoing dap (XXX) is not in the path. + :: =. +>.$ ap-abet:(ap-pout:pap t.t.t.pax %quit ~) + :: %+ mo-pass + :: [%use pax] + :: [%g %deal [q.q.pry our] XXX %pull ~] + (mo-resume-mack ~ >%mo-cook-fail< p.q.+>.q.hin) + == + ?. ?=({$g $unto *} q.hin) ~& [%mo-cook-weird q.hin] ~& [%mo-cook-weird-path pax] +>.$ + ?: ?=($doff +>-.q.hin) + %+ mo-pass + [%use pax] + [%f %exec our ~ byk.pap %vale +.p.q.hin] + ?: ?=($quit +>-.q.hin) + =. ap.pap (mo-resume-mack:pap ~) + ap-abet:(ap-pout:pap t.t.t.pax +>.q.hin) ap-abet:(ap-pout:pap t.t.t.pax +>.q.hin) == :: @@ -523,23 +554,31 @@ ?- -.rok :: %m [%f %exec our ~ (mo-beak dap) %vale p.rok q.rok] $m [%g %deal [him our] dap %puff p.rok q.rok] - $l [%g %deal [him our] dap %peel p.rok q.rok] $s [%g %deal [him our] dap %peer p.rok] $u [%g %deal [him our] dap %pull ~] == :: ++ mo-gawd :: ames backward |= {him/@p dap/dude num/@ud ron/roon} - ?- -.ron - $d - %+ mo-pass - [%sys %rep (scot %p him) dap (scot %ud num) ~] - [%f %exec our ~ (mo-beak dap) %vale p.ron q.ron] - :: - $x =. +> (mo-give %mack ~) :: XX should crash - (mo-give(hen (mo-ball him num)) %unto %quit ~) + =. mak (mo-defer-mack hen) + =. hen (mo-ball him num) + ?- -.ron + $d (mo-give %unto %doff p.ron q.ron) + $x (mo-give %unto %quit ~) == :: + ++ mo-defer-mack :: future %mack + |= hon/duct ^+ mak + ?~ mak `hon + ~|(double-mak+[u.mak hon] !!) + :: + ++ mo-resume-mack :: route %mack + |= a/(unit tang) ^+ +>.$ + ?^ mak + +>.$(mak ~, moz :_(moz [u.mak %give %mack a])) + ?~ a +>.$ + (mean >%gall-mack< u.a) :: XX unnecessary? + :: ++ ap :: agent engine ~% %gall-ap +> ~ |_ $: $: dap/dude @@ -594,7 +633,7 @@ ?~ ded +>.^$ => %*(. $(ded t.ded) ost i.ded) =+ tib=(~(get by sup.ged) ost) - ?~ tib ~&([%ap-abut-bad-bone dap ost] ..ap-kill) + ?~ tib ..ap-kill ap-kill(q.q.pry p.u.tib) :: ++ ap-aver :: cove to move @@ -1080,6 +1119,7 @@ ?- -.cuf $coup (ap-take q.q.pry %coup +.pax `!>(p.cuf)) $diff (ap-diff q.q.pry pax p.cuf) + $doff !! $quit (ap-take q.q.pry %quit +.pax ~) $reap (ap-take q.q.pry %reap +.pax `!>(p.cuf)) == @@ -1239,6 +1279,7 @@ $info `%c $merg `%c $mont `%c + $nuke `%a $ogre `%c $serv `%e $them `%e diff --git a/arvo/zuse.hoon b/arvo/zuse.hoon index 2851f6b155..c0a918c3f2 100644 --- a/arvo/zuse.hoon +++ b/arvo/zuse.hoon @@ -2364,13 +2364,21 @@ $: rtt/@dr :: decaying avg rtt wid/@ud :: logical wdow msgs == :: -++ fort :: formal state +++ furt :: formal state $: $0 :: version gad/duct :: client interface hop/@da :: network boot date ton/town :: security zac/(map ship corn) :: flows by server == :: +++ fort :: formal state + $: $1 :: version + gad/duct :: client interface + hop/@da :: network boot date + bad/(set @p) :: bad ships + ton/town :: security + zac/(map ship corn) :: flows by server + == :: ++ gank (each vase (list tank)) :: abstract result ++ gilt {@tas *} :: presumed gift ++ gens {p/lang q/gcos} :: general identity @@ -2676,6 +2684,7 @@ {$hole p/lane q/@} :: packet failed {$junk p/@} :: entropy {$kick p/@da} :: wake up + {$nuke p/@p} :: toggle auto-block {$make p/(unit @t) q/@ud r/@ s/?} :: wild license {$sith p/@p q/@uw r/?} :: imperial generator {$wake $~} :: timer activate @@ -2951,6 +2960,7 @@ ++ cuft :: internal gift $% {$coup p/(unit tang)} :: poke result {$diff p/cage} :: subscription output + {$doff p/mark q/noun} :: untyped diff {$quit $~} :: close subscription {$reap p/(unit tang)} :: peer result == :: diff --git a/gen/hood/nuke.hoon b/gen/hood/nuke.hoon new file mode 100644 index 0000000000..40b60de91e --- /dev/null +++ b/gen/hood/nuke.hoon @@ -0,0 +1,13 @@ +:: nuke: reject packets from. +:: +:::: /hoon/mount/hood/gen + :: +/? 310 +:: +:::: + !: +:- %say +|= $: {now/@da eny/@uvJ bec/beak} + {{him/@p $~} $~} + == +[%helm-nuke him] diff --git a/lib/helm.hoon b/lib/helm.hoon index 1f6ae12000..3d8e856644 100644 --- a/lib/helm.hoon +++ b/lib/helm.hoon @@ -30,6 +30,9 @@ ++ hood-init :: report init $: him/ship :: == :: +++ hood-nuke :: block/unblock + $: him/ship :: + == :: ++ hood-reset :: reset command $~ :: ++ hood-deset :: reset command @@ -53,6 +56,7 @@ $% {$cash wire p/@p q/buck} :: {$conf wire dock $load ship term} :: {$flog wire flog} :: + {$nuke wire ship} :: {$serv wire ?(desk beam)} :: {$poke wire dock pear} :: {$wont wire sock path *} :: send message @@ -87,6 +91,10 @@ |= him/ship =< abet (emit %flog /helm %crud %hax-init leaf+(scow %p him) ~) :: +++ poke-nuke :: initialize + |= him/ship =< abet + (emit %nuke /helm him) +:: ++ poke-mass |= $~ =< abet (emit %flog /heft %crud %hax-heft ~) From de0f08c8f39e3900ba7f3bf5cb1553f1b8ab9ccf Mon Sep 17 00:00:00 2001 From: "C. Guy Yarvin" Date: Wed, 17 May 2017 10:32:32 -0700 Subject: [PATCH 2/2] Improved packet blocker. --- arvo/ames.hoon | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/arvo/ames.hoon b/arvo/ames.hoon index bbbd8b36c1..ea59c7a80a 100644 --- a/arvo/ames.hoon +++ b/arvo/ames.hoon @@ -1182,9 +1182,6 @@ |% ++ apse ^+ +>.$ - ?: =(%dead kay) - ~& [%dead-ack source+her packet+`@p`(mug dam)] - cock =+ oub=bust:puz =+ neg==(~ yed.caq.dur.diz) =. +>.$ east @@ -1294,6 +1291,14 @@ ++ deer :: deer:la:ho:um:am |= {cha/path num/@ud dut/(unit)} :: interpret message ^+ +> + :: + :: these patches are both hacks and result in + :: unnecessary transmissions. but they should + :: solve the problem that needs to be solved: + :: acknowledging messages after a bad skip. + :: + =. kay ?.((~(has in bad.fox) her) kay %dead) + =. +> ?.(=(%dead kay) +> cock) =+ rum=(fall (~(get by raz.bah) cha) *race) %= +>.$ +>