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
src = fetchgit {
url = "https://git.sr.ht/~ehmry/dhall-genode";
rev = "aecb2db8b23421addb57aa29cfc17d9c4601b6e5";
sha256 = "17wv761fmbk6wzjjrlzj4lb2lazl5p95izni000xf7lra5xllilq";
rev = "b9630af18be8956562ffba026f7bfc3b55b093b1";
sha256 = "072w6g3561qnhfw2j721584c6ds9bw4f9xq1j5ggj3p0fhf5yp5z";
};
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="nix"><fs label="nix" root="nix"/></dir>
</vfs>
<default-policy root="/" writeable="yes"/>
''
]
, defaultPolicy = Some Init.Config.DefaultPolicy::{
, attributes = toMap { root = "/", writeable = "yes" }
}
}
, provides = [ "File_system" ]
, resources = Genode.Init.Resources::{

View File

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

View File

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

View File

@ -22,11 +22,7 @@ in λ(guest : { linux : Text, dtb : Text, initrd : Text })
, binary = "nic_router"
, config = Init.Config::{
, content =
[ XML.leaf
{ name = "default-policy"
, attributes = toMap { domain = "default" }
}
, XML.element
[ XML.element
{ name = "domain"
, attributes = toMap
{ 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" ]
, resources = Init.Resources::{ ram = Genode.units.MiB 8 }

View File

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