2
0
Fork 0

nixos-module: add nic_router

This commit is contained in:
Emery Hemingway 2020-06-09 20:50:29 +05:30
parent 576c1ca41a
commit 78cf596db3
2 changed files with 71 additions and 1 deletions

View File

@ -111,6 +111,7 @@
"log_core"
"nit_fb"
"nitpicker"
"nic_router"
"part_block"
"platform_drv"
"posix"

View File

@ -660,6 +660,75 @@ let rootInit =
(Some "nic_drv")
]
}
, nic_router =
Child.flat
Child.Attributes::{
, binary = "nic_router"
, config = Init.Config::{
, content =
[ XML.leaf
{ name = "uplink"
, attributes = toMap { domain = "uplink" }
}
, XML.element
{ name = "domain"
, attributes = toMap { name = "uplink" }
, content =
[ XML.leaf
{ name = "nat"
, attributes = toMap
{ domain = "default"
, tcp-ports = "1024"
, udp-ports = "1024"
, icmp-ids = "1024"
}
}
]
}
, XML.element
{ name = "domain"
, attributes = toMap
{ name = "default", interface = "10.0.1.1/24" }
, content =
[ XML.leaf
{ name = "dhcp-server"
, attributes = toMap
{ ip_first = "10.0.1.2"
, ip_last = "10.0.1.200"
, dns_server_from = "uplink"
}
}
]
# Prelude.List.map
Text
XML.Type
( λ(proto : Text)
→ XML.element
{ name = proto
, attributes = toMap
{ dst = "0.0.0.0/0"
, domain = "uplink"
}
, content =
[ XML.leaf
{ name = "permit-any"
, attributes = toMap
{ domain = "uplink" }
}
]
}
)
[ "tcp", "udp", "icmp" ]
}
]
, defaultPolicy = Some DefaultPolicy::{
, attributes = toMap { domain = "default" }
}
}
, provides = [ "Nic" ]
, resources = Init.Resources::{ ram = Genode.units.MiB 8 }
, routes = [ ServiceRoute.child "Nic" "nic_drv" ]
}
, init =
Init.toChild
Init::{ children = params.guests }
@ -701,7 +770,7 @@ let rootInit =
}
}
, ServiceRoute.child "File_system" "chroot"
, ServiceRoute.child "Nic" "nic_drv"
, ServiceRoute.child "Nic" "nic_router"
, ServiceRoute.child "Rtc" "rtc"
, ServiceRoute.parentLabel
"ROM"