vfs/lxip: make gateway config attribute optional

This enables the application in router/gateway-less network
configurations, e.g., test environments.
This commit is contained in:
Christian Helmuth 2018-06-07 15:05:46 +02:00
parent 05f2ecc045
commit 91b2e023b8
2 changed files with 2 additions and 6 deletions

View File

@ -1616,19 +1616,15 @@ class Vfs::Lxip_file_system : public Vfs::File_system,
Addr gateway = config.attribute_value("gateway", Addr());
Addr nameserver = config.attribute_value("nameserver", Addr());
/* either none or all 4 interface attributes must exist */
if (ip_addr == "") {
warning("Missing \"ip_addr\" attribute. Ignoring network interface config.");
throw Genode::Xml_node::Nonexistent_attribute();
} else if (netmask == "") {
warning("Missing \"netmask\" attribute. Ignoring network interface config.");
throw Genode::Xml_node::Nonexistent_attribute();
} else if (gateway == "") {
warning("Missing \"gateway\" attribute. Ignoring network interface config.");
throw Genode::Xml_node::Nonexistent_attribute();
}
log("static network interface: ip_addr=",ip_addr," netmask=",netmask," gateway=",gateway);
log("static network interface: ip_addr=",ip_addr," netmask=",netmask);
lxip_configure_static(ip_addr.string(), netmask.string(),
gateway.string(), nameserver.string());

View File

@ -64,7 +64,7 @@ append_if [use_dynamic_rom] config {
<config ld_verbose="yes">
<vfs>
<dir name="socket">
<lxip mtu="400" ip_addr="10.0.2.55" netmask="255.255.255.0" gateway="10.0.2.1" nameserver="8.8.8.8"/>
<lxip mtu="400" ip_addr="10.0.2.55" netmask="255.255.255.0" nameserver="8.8.8.8"/>
</dir>
</vfs>
<default-policy root="/socket" writeable="yes" />