nic_router: fix interface update on missing domain

When updating an interface in the NIC router to a new configuration and
the domain name of the interface has not changed but the domain
disappeared, the NIC router did not detach from the old domain correctly
which led to broken remnants of interface state objects (like connection
states).

Adapt the nic_router_uplinks run script to work with the fix.
This commit is contained in:
Martin Stein 2018-05-29 15:24:40 +02:00 committed by Christian Helmuth
parent e2559a822b
commit 1306892fbf
3 changed files with 36 additions and 40 deletions

View File

@ -154,7 +154,7 @@ append config {
<sleep milliseconds="3002"/> <sleep milliseconds="3002"/>
<inline> <inline>
<config dhcp_discover_timeout_sec="1"> <config dhcp_discover_timeout_sec="1" verbose="yes">
<default-policy domain="downlink"/> <default-policy domain="downlink"/>
<domain name="downlink" interface="10.0.1.79/24"> <domain name="downlink" interface="10.0.1.79/24">
<dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/> <dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/>
@ -196,7 +196,7 @@ append config {
<sleep milliseconds="3005"/> <sleep milliseconds="3005"/>
<inline> <inline>
<config dhcp_discover_timeout_sec="1"> <config dhcp_discover_timeout_sec="1" verbose="yes">
<default-policy domain="downlink"/> <default-policy domain="downlink"/>
<domain name="downlink" interface="10.0.1.79/24"> <domain name="downlink" interface="10.0.1.79/24">
<dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/> <dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/>
@ -242,7 +242,6 @@ append config {
<default-policy domain="downlink"/> <default-policy domain="downlink"/>
<domain name="downlink" interface="10.0.1.79/24"> <domain name="downlink" interface="10.0.1.79/24">
<dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/> <dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain> </domain>
</config> </config>
@ -318,40 +317,40 @@ append_platform_drv_boot_modules
build_boot_image $boot_modules build_boot_image $boot_modules
append done_string ".*router.config: change.*" append done_string ".*router.config: change"
append done_string ".*router.config: sleep 3001 milliseconds.*" append done_string ".*router.config: sleep 3001 milliseconds"
append done_string ".*64 bytes from 1.1.1.1: icmp_seq=.*" append done_string ".*64 bytes from 1.1.1.1: icmp_seq="
append done_string ".*router.config: change.*" append done_string ".*router.config: change"
append done_string ".*router.config: sleep 3002 milliseconds.*" append done_string ".*router.config: sleep 3002 milliseconds"
append done_string ".*64 bytes from 1.1.1.1: icmp_seq=.*" append done_string ".*64 bytes from 1.1.1.1: icmp_seq="
append done_string ".*router.config: change.*" append done_string ".*router.config: change"
append done_string ".*router.config: sleep 3003 milliseconds.*" append done_string ".*router.config: sleep 3003 milliseconds"
append done_string "From 10.0.1.79 icmp_seq=.* Destination Unreachable" append done_string ".*downlink.*invalid domain.*invalid ICMP rule"
append done_string ".*router.config: change.*" append done_string ".*router.config: change"
append done_string ".*router.config: sleep 3004 milliseconds.*" append done_string ".*router.config: sleep 3004 milliseconds"
append done_string ".*64 bytes from 1.1.1.1: icmp_seq=.*" append done_string ".*64 bytes from 1.1.1.1: icmp_seq="
append done_string ".*router.config: change.*" append done_string ".*router.config: change"
append done_string ".*router.config: sleep 3005 milliseconds.*" append done_string ".*router.config: sleep 3005 milliseconds"
append done_string ".*64 bytes from 1.1.1.1: icmp_seq=.*" append done_string ".*64 bytes from 1.1.1.1: icmp_seq="
append done_string ".*router.config: change.*" append done_string ".*router.config: change"
append done_string ".*router.config: sleep 3006 milliseconds.*" append done_string ".*router.config: sleep 3006 milliseconds"
append done_string "From 10.0.1.79 icmp_seq=.* Destination Unreachable" append done_string ".*downlink.*invalid domain.*invalid ICMP rule"
append done_string ".*router.config: change.*" append done_string ".*router.config: change"
append done_string ".*router.config: sleep 3007 milliseconds.*" append done_string ".*router.config: sleep 3007 milliseconds"
append done_string ".*64 bytes from 1.1.1.1: icmp_seq=.*" append done_string ".*64 bytes from 1.1.1.1: icmp_seq="
append done_string ".*router.config: change.*" append done_string ".*router.config: change"
append done_string ".*router.config: sleep 3008 milliseconds.*" append done_string ".*router.config: sleep 3008 milliseconds"
append done_string ".*64 bytes from 1.1.1.1: icmp_seq=.*" append done_string ".*64 bytes from 1.1.1.1: icmp_seq="
append done_string ".*router.config: change.*" append done_string ".*router.config: change"
append done_string ".*router.config: sleep 600000 milliseconds.*" append done_string ".*router.config: sleep 600000 milliseconds"
append done_string "From 10.0.1.79 icmp_seq=.* Destination Unreachable" append done_string ".*From 10.0.1.79 icmp_seq=.* Destination Unreachable"
run_genode_until $done_string 60 run_genode_until $done_string 60

View File

@ -233,9 +233,8 @@ Interface::_transport_rules(Domain &local_domain, L3_protocol const prot) const
} }
void Interface::_attach_to_domain_raw(Domain_name const &domain_name) void Interface::_attach_to_domain_raw(Domain &domain)
{ {
Domain &domain = _config().domains().find_by_name(domain_name);
_domain = domain; _domain = domain;
Signal_transmitter(_link_state_sigh).submit(); Signal_transmitter(_link_state_sigh).submit();
_interfaces.remove(this); _interfaces.remove(this);
@ -255,7 +254,7 @@ void Interface::_detach_from_domain_raw()
void Interface::_attach_to_domain(Domain_name const &domain_name) void Interface::_attach_to_domain(Domain_name const &domain_name)
{ {
_attach_to_domain_raw(domain_name); _attach_to_domain_raw(_config().domains().find_by_name(domain_name));
attach_to_domain_finish(); attach_to_domain_finish();
} }
@ -1566,15 +1565,15 @@ void Interface::handle_config_2()
try { try {
/* if the domains differ, detach completely from the domain */ /* if the domains differ, detach completely from the domain */
Domain &old_domain = domain(); Domain &old_domain = domain();
Domain &new_domain = _config().domains().find_by_name(new_domain_name);
if (old_domain.name() != new_domain_name) { if (old_domain.name() != new_domain_name) {
_detach_from_domain(); _detach_from_domain();
_attach_to_domain_raw(new_domain_name); _attach_to_domain_raw(new_domain);
return; return;
} }
/* move to new domain object without considering any state objects */ /* move to new domain object without considering any state objects */
_detach_from_domain_raw(); _detach_from_domain_raw();
_attach_to_domain_raw(new_domain_name); _attach_to_domain_raw(new_domain);
Domain &new_domain = domain();
/* remember that the interface stays attached to the same domain */ /* remember that the interface stays attached to the same domain */
_update_domain = *new (_alloc) _update_domain = *new (_alloc)
@ -1590,9 +1589,7 @@ void Interface::handle_config_2()
catch (Pointer<Domain>::Invalid) { catch (Pointer<Domain>::Invalid) {
/* the interface had no domain but now it may get one */ /* the interface had no domain but now it may get one */
try { try { _attach_to_domain_raw(_config().domains().find_by_name(new_domain_name)); }
_attach_to_domain_raw(new_domain_name);
}
catch (Domain_tree::No_match) { } catch (Domain_tree::No_match) { }
} }
} }

View File

@ -269,7 +269,7 @@ class Net::Interface : private Interface_list::Element
void _attach_to_domain(Domain_name const &domain_name); void _attach_to_domain(Domain_name const &domain_name);
void _attach_to_domain_raw(Domain_name const &domain_name); void _attach_to_domain_raw(Domain &domain);
void _apply_foreign_arp(); void _apply_foreign_arp();