Commit:    f8f006b87c1046f9ff80e1a406914add9d07ed65
Author:    Jacques Marneweck <[email protected]>         Wed, 18 Sep 2013 
14:06:42 +0200
Parents:   24f4d10028f1f37eb03b96c268195d8d4c59bb77
Branches:  master

Link:       
http://git.php.net/?p=web/php.git;a=commitdiff;h=f8f006b87c1046f9ff80e1a406914add9d07ed65

Log:
Ignore RFC 6598's 100.64.0.0/10 which is used by carrier grade nat devices and 
should not be routable on the internet

Signed-off-by: Jacques Marneweck <[email protected]>

Changed paths:
  M  include/ip-to-country.inc


Diff:
diff --git a/include/ip-to-country.inc b/include/ip-to-country.inc
index ccd203a..e45d404 100644
--- a/include/ip-to-country.inc
+++ b/include/ip-to-country.inc
@@ -206,7 +206,8 @@ function i2c_realip()
         for ($i = 0; $i < count($ips); $i++) {
             // Skip RFC 1918 IP's 10.0.0.0/8, 172.16.0.0/12 and
             // 192.168.0.0/16
-            if (!preg_match('/^(?:10|172\.(?:1[6-9]|2\d|3[01])|192\.168)\./', 
$ips[$i])) {
+            // Also skip RFC 6598 IP's
+            if 
(!preg_match('/^(?:10|100\.(?:6[4-9]|[7-9]\d|1[01]\d|12[0-7])|172\.(?:1[6-9]|2\d|3[01])|192\.168)\./',
 $ips[$i])) {
                 if (version_compare(phpversion(), "5.0.0", ">=")) {
                     if (ip2long($ips[$i]) != false) {
                         $ip = $ips[$i];


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to