From 845694bc44573a8af0ce55fbdaa20cf779f3ee5d Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Mon, 16 Jan 2023 14:36:16 +0100 Subject: [PATCH] nic_router: fix updating UDP/TCP links This fixes a bug that was introduced by this earlier commit: "nic_router: find forward rules w/o exceptions" The NIC router used to falsely dissolve TCP/UDP connection states when reconfiguring although the connection states were still legal according to the new config. The reason was that the above mention commit nested lambdas but missed to return from the last nesting level when having found a configuration that legitimates the connection state. Ref #4728 --- repos/os/src/server/nic_router/interface.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/repos/os/src/server/nic_router/interface.cc b/repos/os/src/server/nic_router/interface.cc index e4d3f668b7..4bf725fc03 100644 --- a/repos/os/src/server/nic_router/interface.cc +++ b/repos/os/src/server/nic_router/interface.cc @@ -1989,6 +1989,7 @@ void Interface::_update_udp_tcp_links(L3_protocol prot, try { /* try to find forward rule that matches the server port */ + bool done { false }; _forward_rules(cln_dom, prot).find_by_port( link.client().dst_port(), [&] /* handle_match */ (Forward_rule const &rule) @@ -2026,7 +2027,6 @@ void Interface::_update_udp_tcp_links(L3_protocol prot, [&] /* handle_no_match */ () { try { /* try to find transport rule that matches the server IP */ - bool done { false }; _transport_rules(cln_dom, prot).find_best_match( link.client().dst_ip(), link.client().dst_port(), @@ -2048,6 +2048,9 @@ void Interface::_update_udp_tcp_links(L3_protocol prot, catch (Dismiss_link) { } } ); + if (done) { + return; + } } catch (Dismiss_link) { } destroy_link(link);