Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-48766

Support IPv6 in IP lookup tool

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      phpunit
      Define PHPUNIT_LONGTEST and run iplookup/tests/geoip_test.php and iplookup/tests/geoplugin_test.php

      Setup:

      You'll need to lookup some ipv4/ipv6 addresses, a simple way to do this is to update some log records in your dabase with update mdl_logstore_standard_log set ip = '<IP>';

      • You can use 2a01:8900:2:3:8c6c:c0db:3d33:9ce6 as an ipv6 address - its in Lancaster, UK
      • You can use 147.230.16.1 as an ipv4 address - it (used to be identified as Liberec, but now is Ceska Lipa) - Czech Republic
      • You can use 10.0.1.1 as an private address
      • (Try some others )

      Test

      1. Go to Admin > Settings > Location
      2. Empty the geoip2file setting, so its not set (or pointing to an invalid path). The means we'll use the online service which doesn't support ipv6.
      3. Go to admin > report > logs
      4. VERIFY: Click on the ipv4 addreses in the log report - it should show the location in CZ correctly.
      5. VERIFY: Click on the ipv6 address - it should say that the address fromat is not supported
      6. VERIFY: Click on the private address - it should say that private ip addresses are not supported
      7. Go to Admin > Settings > Location
      8. Setup geoip2file correctly from https://dev.maxmind.com/geoip/geoip2/geolite2/
      9. Go to admin > report > logs
      10. VERIFY: Click on the ipv4 addreses in the log report - it should show the location in CZ correctly.
      11. VERIFY: Click on the ipv6 address - it should show the location in Lancaster correctly.
      12. VERIFY: Click on the private address - it should say that private ip addresses are not supported
      Show
      phpunit Define PHPUNIT_LONGTEST and run iplookup/tests/geoip_test.php and iplookup/tests/geoplugin_test.php Setup: You'll need to lookup some ipv4/ipv6 addresses, a simple way to do this is to update some log records in your dabase with update mdl_logstore_standard_log set ip = '<IP>'; You can use 2a01:8900:2:3:8c6c:c0db:3d33:9ce6 as an ipv6 address - its in Lancaster, UK You can use 147.230.16.1 as an ipv4 address - it (used to be identified as Liberec, but now is Ceska Lipa) - Czech Republic You can use 10.0.1.1 as an private address (Try some others ) Test Go to Admin > Settings > Location Empty the geoip2file setting, so its not set (or pointing to an invalid path). The means we'll use the online service which doesn't support ipv6. Go to admin > report > logs VERIFY: Click on the ipv4 addreses in the log report - it should show the location in CZ correctly. VERIFY: Click on the ipv6 address - it should say that the address fromat is not supported VERIFY: Click on the private address - it should say that private ip addresses are not supported Go to Admin > Settings > Location Setup geoip2file correctly from https://dev.maxmind.com/geoip/geoip2/geolite2/ Go to admin > report > logs VERIFY: Click on the ipv4 addreses in the log report - it should show the location in CZ correctly. VERIFY: Click on the ipv6 address - it should show the location in Lancaster correctly. VERIFY: Click on the private address - it should say that private ip addresses are not supported
    • Affected Branches:
      MOODLE_28_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE
    • Pull Master Branch:
      MDL-48766-master

      Description

      IP lookup tool supports only IPv4 addresses, but not IPv6. So using this tool (e. g. like https://moodle.example.net/iplookup/index.php?ip=2001:db8::1428:57ab) displays error Invalid IP format.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              poltawski Dan Poltawski
              Reporter:
              ragimiri Lukas Mizoch
              Peer reviewer:
              Simey Lameze Simey Lameze
              Integrator:
              David Monllaó David Monllaó
              Tester:
              Rajesh Taneja Rajesh Taneja
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              3 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                5/Dec/16