Small fix in EPP regarding different representation of IPv6

This commit is contained in:
Pinga 2024-07-30 11:15:04 +03:00
parent 5c6ff7f087
commit ea6a79b5c5
2 changed files with 30 additions and 0 deletions

View file

@ -76,6 +76,9 @@ $server->handle(function (Connection $conn) use ($table, $pool, $c, $log, $permi
// Get the client information
$clientInfo = $conn->exportSocket()->getpeername();
$clientIP = isset($clientInfo['address']) ? (strpos($clientInfo['address'], '::ffff:') === 0 ? substr($clientInfo['address'], 7) : $clientInfo['address']) : '';
if (isIPv6($clientIP)) {
$clientIP = expandIPv6($clientIP);
}
// Check if the IP is in the permitted list
if (!$permittedIPsTable->exist($clientIP)) {