From 2343a762fb62ebed6ef140bca2d8b5aa4fa2983d Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Sun, 6 Feb 2011 12:44:16 +0100
Subject: [PATCH] handle link local and localhost IPv6 addresses in clientIP
 FS#2138

---
 inc/common.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/inc/common.php b/inc/common.php
index eab5f1129..23d9c7155 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -639,7 +639,7 @@ function clientIP($single=false){
     // decide which IP to use, trying to avoid local addresses
     $ip = array_reverse($ip);
     foreach($ip as $i){
-        if(preg_match('/^(127\.|10\.|192\.168\.|172\.((1[6-9])|(2[0-9])|(3[0-1]))\.)/',$i)){
+        if(preg_match('/^(::1|[fF][eE]80:|127\.|10\.|192\.168\.|172\.((1[6-9])|(2[0-9])|(3[0-1]))\.)/',$i)){
             continue;
         }else{
             return $i;
-- 
GitLab