mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-21 22:47:50 +00:00
sculpt: add "http" and "telnet" nic_router domains
These domains allow for the hosting of plain http and telnet servers reachable from the outside. The change is designated for the goa testbed. Issue #5092
This commit is contained in:
parent
c2cd4102d8
commit
7c76ec897c
@ -29,6 +29,17 @@ void Sculpt::Network::_generate_nic_router_uplink(Xml_generator &xml,
|
||||
xml.attribute("udp-ports", "1000");
|
||||
xml.attribute("icmp-ids", "1000");
|
||||
});
|
||||
|
||||
auto tcp_forward = [&] (uint16_t port, auto const &domain, auto const &to)
|
||||
{
|
||||
xml.node("tcp-forward", [&] {
|
||||
xml.attribute("port", port);
|
||||
xml.attribute("domain", domain);
|
||||
xml.attribute("to", to); });
|
||||
};
|
||||
|
||||
tcp_forward(80 /* HTTP */ , "http", "10.0.80.2");
|
||||
tcp_forward(23 /* telnet */ , "telnet", "10.0.23.2");
|
||||
});
|
||||
}
|
||||
|
||||
@ -113,6 +124,30 @@ void Sculpt::Network::_generate_nic_router_config()
|
||||
xml.attribute("domain", "uplink"); });
|
||||
}
|
||||
});
|
||||
|
||||
auto tcp_service_domain = [&] (auto const &name, auto const &ip_prefix)
|
||||
{
|
||||
using Ip = String<16>;
|
||||
|
||||
Ip const interface { ip_prefix, ".1/24" },
|
||||
dhcp_addr { ip_prefix, ".2" };
|
||||
|
||||
xml.node("policy", [&] {
|
||||
xml.attribute("label", name);
|
||||
xml.attribute("domain", name); });
|
||||
|
||||
gen_named_node(xml, "domain", name, [&] () {
|
||||
xml.attribute("interface", interface);
|
||||
xml.node("dhcp-server", [&] {
|
||||
xml.attribute("ip_first", dhcp_addr);
|
||||
xml.attribute("ip_last", dhcp_addr);
|
||||
if (_nic_target.type() != Nic_target::DISCONNECTED) {
|
||||
xml.attribute("dns_config_from", "uplink"); }
|
||||
});
|
||||
});
|
||||
};
|
||||
tcp_service_domain("http", "10.0.80");
|
||||
tcp_service_domain("telnet", "10.0.23");
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user