Missing Function


  • Moderator

    I think there is a missing function (and should be unreferenced)-

    subnetv6_expand()

    I think it would be bad anyways to expand an IPv6 /64…

    But just pointing out that the function subnet_expand() should be re-written to address this issue.

    Expanding an IPv6 /64 would probably causes memory issues in PHP  :)

    18,446,744,073,709,551,616 IPv6 addresses in a /64

    /etc/inc/util.inc

    function subnet_expand($subnet) {
            if (is_subnetv4($subnet)) {
                    return subnetv4_expand($subnet);
            } else if (is_subnetv6($subnet)) {
                    return subnetv6_expand($subnet);
            } else {
                    return $subnet;
            }
    }



  • Yes, that is a latent issue waiting for some sucker to try and call it with an IPv6 address!

    subnetv4_expand() is called directly from a couple of places in the base system and works.

    subnet_expand() is not called by anything in the base system.

    subnetv6_expand() is only mentioned inside subnet_expand()

    and yes, I can't imagine anything that would require and handle subnetv6_expand() of a /64 (or bigger)!
    The only small use for this would be in some places where there are pools. e.g. for V4 it is used in vslb.inc where people can have put a virtual server pool by specifying a "subnet" like 10.11.12.8/29 gives a pool of 8 IP addresses. The front-end GUI code limits it to a maximum size pool of 64 (x.x.x.x/26).
    I guess the same possibility of having a group of servers with IP addresses in a tiny IPv6 "subnet" would also work.

    The reference to a non-existent function was introduced in 2012 by:
    https://github.com/pfsense/pfsense/commit/0917cb214b2bbf7f4b374c901c642987fc4ac63b


Log in to reply