2
0
Fork 0

dhall: policy specification

This commit is contained in:
Ehmry - 2020-06-07 01:40:32 +05:30
parent 60473079e8
commit 100be5270a
7 changed files with 42 additions and 30 deletions

View File

@ -8,8 +8,8 @@ dhallPackages.buildDhallPackage {
code = let code = let
src = fetchgit { src = fetchgit {
url = "https://git.sr.ht/~ehmry/dhall-genode"; url = "https://git.sr.ht/~ehmry/dhall-genode";
rev = "aecb2db8b23421addb57aa29cfc17d9c4601b6e5"; rev = "b9630af18be8956562ffba026f7bfc3b55b093b1";
sha256 = "17wv761fmbk6wzjjrlzj4lb2lazl5p95izni000xf7lra5xllilq"; sha256 = "072w6g3561qnhfw2j721584c6ds9bw4f9xq1j5ggj3p0fhf5yp5z";
}; };
in src + "/package.dhall"; in src + "/package.dhall";

View File

@ -35,9 +35,11 @@ in λ(params : { bash : Text, coreutils : Text, script : Text })
<dir name="tmp"><ram/></dir> <dir name="tmp"><ram/></dir>
<dir name="nix"><fs label="nix" root="nix"/></dir> <dir name="nix"><fs label="nix" root="nix"/></dir>
</vfs> </vfs>
<default-policy root="/" writeable="yes"/>
'' ''
] ]
, defaultPolicy = Some Init.Config.DefaultPolicy::{
, attributes = toMap { root = "/", writeable = "yes" }
}
} }
, provides = [ "File_system" ] , provides = [ "File_system" ]
, resources = Genode.Init.Resources::{ , resources = Genode.Init.Resources::{

View File

@ -32,13 +32,15 @@ let init =
, routes = [ ServiceRoute.child "Nic" "nic" ] , routes = [ ServiceRoute.child "Nic" "nic" ]
, config = Init.Config::{ , config = Init.Config::{
, attributes = toMap { mac = "02:02:02:02:03:00" } , attributes = toMap { mac = "02:02:02:02:03:00" }
, content = , policies =
[ Genode.Prelude.XML.text [ Init.Config.Policy::{
'' , attributes = toMap { ip_addr = "10.0.0.2" }
<policy label_prefix="solo5" ip_addr="10.0.0.2"/> , label =
<default-policy/> Init.LabelSelector.Type.Partial
'' { prefix = Some "solo5", suffix = None Text }
}
] ]
, defaultPolicy = Some Init.Config.DefaultPolicy::{=}
} }
} }
, solo5 = , solo5 =

View File

@ -29,13 +29,18 @@ let init =
, provides = [ "Nic" ] , provides = [ "Nic" ]
, routes = [ Genode.Init.ServiceRoute.child "Nic" "nic" ] , routes = [ Genode.Init.ServiceRoute.child "Nic" "nic" ]
, config = Init.Config::{ , config = Init.Config::{
, content = , defaultPolicy = Some Init.Config.DefaultPolicy::{=}
[ Genode.Prelude.XML.text , policies =
'' [ Init.Config.Policy::{
<policy label="solo5 -> service0" ip_addr="10.0.0.2"/> , attributes = toMap { ip_addr = "10.0.0.2" }
<policy label="solo5 -> service1" ip_addr="10.1.0.2"/> , label =
<default-policy/> Init.LabelSelector.Type.Scoped "solo5 -> service0"
'' }
, Init.Config.Policy::{
, attributes = toMap { ip_addr = "10.1.0.2" }
, label =
Init.LabelSelector.Type.Scoped "solo5 -> service1"
}
] ]
} }
} }

View File

@ -129,11 +129,10 @@ in λ(test : Test.Type)
} }
] ]
} }
, XML.leaf
{ name = "default-policy"
, attributes = toMap { root = "/", writeable = "no" }
}
] ]
, defaultPolicy = Some Init.Config.DefaultPolicy::{
, attributes = toMap { root = "/", writeable = "no" }
}
} }
, provides = [ "File_system" ] , provides = [ "File_system" ]
} }

View File

@ -22,11 +22,7 @@ in λ(guest : { linux : Text, dtb : Text, initrd : Text })
, binary = "nic_router" , binary = "nic_router"
, config = Init.Config::{ , config = Init.Config::{
, content = , content =
[ XML.leaf [ XML.element
{ name = "default-policy"
, attributes = toMap { domain = "default" }
}
, XML.element
{ name = "domain" { name = "domain"
, attributes = toMap , attributes = toMap
{ name = "default" { name = "default"
@ -43,6 +39,9 @@ in λ(guest : { linux : Text, dtb : Text, initrd : Text })
] ]
} }
] ]
, defaultPolicy = Some Init.Config.Policy::{
, attributes = toMap { domain = "default" }
}
} }
, provides = [ "Nic" ] , provides = [ "Nic" ]
, resources = Init.Resources::{ ram = Genode.units.MiB 8 } , resources = Init.Resources::{ ram = Genode.units.MiB 8 }

View File

@ -76,11 +76,16 @@ let pciInit =
, ServiceRoute.parent "IO_PORT" , ServiceRoute.parent "IO_PORT"
] ]
, config = Init.Config::{ , config = Init.Config::{
, content = , policies =
[ XML.text [ Init.Config.Policy::{
'' , content =
<policy label_prefix="test-pci"> <pci class="ALL"/> </policy> [ XML.leaf
'' { name = "pci"
, attributes = toMap { class = "ALL" }
}
]
, label = Init.LabelSelector.Type.Scoped "test-pci"
}
] ]
} }
} }