Not IPv6 compatible

Created on 22 February 2010, over 15 years ago
Updated 12 May 2025, 27 days ago

On examining the code I noticed this module is IPv4 only by the way the IP addresses are checked.

Feature request
Status

Needs work

Version

4.0

Component

Code

Created by

🇳🇱Netherlands mo6

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇦🇺Australia darvanen Sydney, Australia

    Agree this is vaulable, just needs tests to make it part of the module.

  • Merge request !12Make IPv6 compatible → (Open) created by darvanen
  • 🇦🇺Australia darvanen Sydney, Australia

    This change is badly needed for the test suite to run green because gitlab CI uses IPv6 in the browser, however, it is currently failing at the Unit test:

    There were 3 failures:
    1) Drupal\Tests\restrict_by_ip\Unit\UnitTest::testIpFailValidation with data set #3 ('127.0.0.1/8', 'Invalid /8')
    Failed asserting that exception of type "Drupal\restrict_by_ip\Exception\InvalidIPException" is thrown.
    /builds/project/restrict_by_ip/vendor/bin/phpunit:122
    2) Drupal\Tests\restrict_by_ip\Unit\UnitTest::testIpFailValidation with data set #4 ('127.0.0.1/16', 'Invalid /16')
    Failed asserting that exception of type "Drupal\restrict_by_ip\Exception\InvalidIPException" is thrown.
    /builds/project/restrict_by_ip/vendor/bin/phpunit:122
    3) Drupal\Tests\restrict_by_ip\Unit\UnitTest::testIpFailValidation with data set #5 ('127.0.0.1/24', 'Invalid /24')
    Failed asserting that exception of type "Drupal\restrict_by_ip\Exception\InvalidIPException" is thrown.
    /builds/project/restrict_by_ip/vendor/bin/phpunit:122
  • 🇦🇺Australia darvanen Sydney, Australia

    Seems Symfony's IPUtils doesn't check for valid CIDR ranges so that had to be put back in for IPv4 addresses.

    I will admit I asked Junie (AI) to add some IPv6 testing data to the Unit test but I have looked them over and they seem right to me.

    All tests are passing both locally and in the CI.

    I'll leave this a short while for review and if there are no comments I'll commit it.

Production build 0.71.5 2024