com web/php: 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:
include/ip-to-country.inc
| From: | Jacques Marneweck | Date: | Wed, 18 Sep 2013 12:06:42 +0000 |
| Subject: | com web/php: 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: include/ip-to-country.inc |
||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-16624@lists.php.net to get a copy of this message | ||
Commit: f8f006b87c1046f9ff80e1a406914add9d07ed65
Author: Jacques Marneweck <jacques@powertrip.co.za> 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 <jacques@powertrip..co.za>
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];