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
This commit is contained in:
Martin Stein 2023-01-16 14:36:16 +01:00 committed by Christian Helmuth
parent 17e4e2497f
commit 845694bc44

View File

@ -1989,6 +1989,7 @@ void Interface::_update_udp_tcp_links(L3_protocol prot,
try { try {
/* try to find forward rule that matches the server port */ /* try to find forward rule that matches the server port */
bool done { false };
_forward_rules(cln_dom, prot).find_by_port( _forward_rules(cln_dom, prot).find_by_port(
link.client().dst_port(), link.client().dst_port(),
[&] /* handle_match */ (Forward_rule const &rule) [&] /* handle_match */ (Forward_rule const &rule)
@ -2026,7 +2027,6 @@ void Interface::_update_udp_tcp_links(L3_protocol prot,
[&] /* handle_no_match */ () { [&] /* handle_no_match */ () {
try { try {
/* try to find transport rule that matches the server IP */ /* try to find transport rule that matches the server IP */
bool done { false };
_transport_rules(cln_dom, prot).find_best_match( _transport_rules(cln_dom, prot).find_best_match(
link.client().dst_ip(), link.client().dst_ip(),
link.client().dst_port(), link.client().dst_port(),
@ -2048,6 +2048,9 @@ void Interface::_update_udp_tcp_links(L3_protocol prot,
catch (Dismiss_link) { } catch (Dismiss_link) { }
} }
); );
if (done) {
return;
}
} }
catch (Dismiss_link) { } catch (Dismiss_link) { }
destroy_link(link); destroy_link(link);