linking: handle defined target properly with smart filters

This patch fixes the policy to not link the client to the default filter if the
client's defined target is found, is not a filter, does not have any other
filters linked with it. In this case, the client is therefore linked to the
actual defined target. On the other hand, if the client's defined target is a
filter, the client is linked to the first filter in the chain that has the same
target as the defined filter's target.
This commit is contained in:
Julian Bouzas
2024-01-11 10:46:00 -05:00
parent c37f95169d
commit cdeac07814
2 changed files with 9 additions and 1 deletions

View File

@@ -102,6 +102,7 @@ SimpleEventHook {
end
end
si_flags.has_defined_target = false
if target_picked and target then
log:info (si,
string.format ("... defined target picked: %s (%s), can_passthrough:%s",
@@ -110,6 +111,7 @@ SimpleEventHook {
tostring (can_passthrough)))
si_flags.has_node_defined_target = node_defined
si_flags.can_passthrough = can_passthrough
si_flags.has_defined_target = true
event:set_data ("target", target)
elseif target_value and dont_fallback then
-- send error to client and destroy node if linger is not set

View File

@@ -35,11 +35,17 @@ SimpleEventHook {
return
end
-- Get the filter from the given target, if any
-- Get the filter from the given target if it exists, otherwise get the
-- default filter, but only if target was not defined
local target_direction = cutils.getTargetDirection (si.properties)
local filter_target = futils.get_filter_from_target (target_direction, target)
if filter_target ~= nil then
target = filter_target
elseif filter_target == nil and not si_flags.has_defined_target then
filter_target = futils.get_filter_from_target (target_direction, nil)
if filter_target ~= nil then
target = filter_target
end
end
local can_passthrough, passthrough_compatible