[Web] Forwarding hosts: store IPv6 addresses in canonical form

This commit is contained in:
FreddleSpl0it committed 2026-11-09 23:24:39 +01:00
1 parent 262de81da1
commit 45d31b3279
1 file changed
+7
+7
View File
@@ -35,6 +35,13 @@ function fwdhost($_action, $_data = null) {
);
return false;
}
$hosts = array_unique(array_map(function ($host) {
$net = explode('/', $host, 2);
if (filter_var($net[0], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$net[0] = inet_ntop(inet_pton($net[0]));
}
return implode('/', $net);
}, $hosts));
foreach ($hosts as $host) {
try {
$redis->hSet('WHITELISTED_FWD_HOST', $host, $source);