diff --git a/.env.example b/.env.example index ca84754..a102f20 100644 --- a/.env.example +++ b/.env.example @@ -48,7 +48,7 @@ MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" FIDO_DIR=fido FIDO_PACKET_KEEP= -FIDO_STRICT=FALSE +FIDO_STRICT=TRUE FILESYSTEM_DISK=s3 AWS_ACCESS_KEY_ID= diff --git a/app/helpers.php b/app/helpers.php index 6f4c7e0..825d998 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -107,10 +107,10 @@ function our_address(Domain $do=NULL,Address $ao=NULL): Collection|Address|NULL $filter = $our->filter(function($item) use ($do) { return $item->zone->domain_id === $do->id; })->sortBy('role'); // If we are looking for a specific address, and there is only 1 result, return it, otherwise return what we have - if ($ao && config('fido.strict') && ($x=$filter->filter(function($item) use ($ao) { return $item->role <= $ao->role; })->sortBy('role'))->count()) - $our = $x; + if ($ao && config('fido.strict') && ($x=$filter->filter(function($item) use ($ao) { return $item->role < $ao->role; })->sortBy('role'))->count()) + $filter = $x; - return $ao ? $our->last() : ($do ? $filter : $our); + return $ao ? $filter->last() : ($do ? $filter : $our); } /** diff --git a/config/fido.php b/config/fido.php index 7f18b92..ac03046 100644 --- a/config/fido.php +++ b/config/fido.php @@ -35,5 +35,6 @@ return [ 'queue_msgs' => env('FIDO_QUEUE_MSGS', 50), // Strict mode enforces what address we present to uplinks, when we carry more than 1 address with different roles - 'strict' => env('FIDO_STRICT',FALSE), + // When true, we'll only present a role that is higher than the node we are talking to + 'strict' => env('FIDO_STRICT',TRUE), ]; \ No newline at end of file