Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Support for IPv6 masked IP4-Addresses #3602

Closed
anonymous-matomo-user opened this issue Dec 11, 2012 · 2 comments
Closed

Added Support for IPv6 masked IP4-Addresses #3602

anonymous-matomo-user opened this issue Dec 11, 2012 · 2 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc. worksforme The issue cannot be reproduced and things work as intended.

Comments

@anonymous-matomo-user
Copy link

This patch fixes a error when using 'GeoIP PECL extension':It's not a translation of real IPv6-addresses.
Most IPv4-Adresses reported by nginx in dual-stack-mode (server[::]:80;)the requests by IPv4-Networks are translated to IPv6 by adding ::ffff:in front of the IPv4-address.

works for me!

!#diff
diff -r bcc59e9000f3 plugins/UserCountry/LocationProvider/GeoIp/Pecl.php
--- a/plugins/UserCountry/LocationProvider/GeoIp/Pecl.php       Tue Dec 11 11:21:50 2012 +0100
+++ b/plugins/UserCountry/LocationProvider/GeoIp/Pecl.php       Tue Dec 11 17:20:24 2012 +0100
@@ -47,14 +47,14 @@
         */
        public function getLocation( $info )
        {
-               $ip = $info['ip'];
+               $ip = str_replace('::ffff:', '', $info['ip']);

                $result = array();

                // get location data
                if (self::isCityDatabaseAvailable())
                {
-                       $location = geoip_record_by_name($ip);
+                       $location = @geoip_record_by_name($ip);
                        if (!empty($location))
                        {
                                $result[self::COUNTRY_CODE_KEY] = $location['country_code'];
@@ -77,7 +77,7 @@
                }
                else
                {
-                       $result[self::COUNTRY_CODE_KEY] = geoip_country_code_by_name($ip);
+                       $result[self::COUNTRY_CODE_KEY] = @geoip_country_code_by_name($ip);
                }

                // get organization data if the org database is available
@anonymous-matomo-user
Copy link
Author

Sorry - Double of #3515

@mattab
Copy link
Member

mattab commented Dec 13, 2012

What exactly is the IPv6 format under nginx ie. reported by nginx in dual-stack-mode (server[::]:80;)

can you give some examples? see also: #3581 for adding ipv6 support (please test the patch and report any feedback in the ticket there)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. worksforme The issue cannot be reproduced and things work as intended.
Projects
None yet
Development

No branches or pull requests

2 participants