Fixed DHCP bug!



  • We found a bug in pfSense 2.0-BETA1 built on Wed Mar 24 10:45:11 UTC 2010 64bit!
    The bug: The specified range lies outside of the current subnet.

    The solution:

    change the 245-246 lines the next:
    Original: $subnet_start = (ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn));
    $subnet_end = (ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn)));

    New:        $subnet_start = ip2long(long2ip(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)))+1;
                    $subnet_end = ip2long(long2ip(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn))))-1;



  • An example of what this fixes?



  • My subnet is 192.168.1.0 netmask 255.255.255.0. If i set dhcp start(192.168.1.10) and end(192.168.1.250) address then it write: "The specified range lies outside of the current subnet." This is no way to configure DHCP in webConfigurator.



  • Adding 1 to the start and subtracting it from the end will remove a valid IP addresses on each side because of the logic elsewhere, making it not allow them.



  • This same bug also afflicts IPSec pool_size generating invalid numbers on amd64, more specifically it's an integer roll over the prior uses on 32 bit systems that a 64 bit wont do since that is its nature being 64



  • This is probably something that needs to be fixed in the functions it calls, not in the code that calls the functions.


  • Rebel Alliance Developer Netgate

    Change ip2long in those function calls to ip2ulong and see if it makes it any better.

    I wrote that function when working with IP ranges and it converts to an unsigned long to prevent just that kind of integer rollover oddity, which is usually only apparent when working near the 127.255.255.255/128.0.0.0 area.



  • @thxer:

    We found a bug in pfSense 2.0-BETA1 built on Wed Mar 24 10:45:11 UTC 2010 64bit!
    The bug: The specified range lies outside of the current subnet.

    The solution:

    change the 245-246 lines the next:
    Original: $subnet_start = (ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn));
    $subnet_end = (ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn)));

    New:         $subnet_start = ip2long(long2ip(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)))+1;
                    $subnet_end = ip2long(long2ip(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn))))-1;

    where i must do this change? same problem. last x64 build



  • under the diagnostics page, you can download the DHCP file, open it with word pad and make the necessary changes.  I'm stuck after that.  I uploaded the file again, but the upload places it in the temp directory.  I tried to use Linux commands but i cant change directories or move the file.  I tried enabling ssh but cant get to the router.  I tried to use the counsel shell but couldn't figure out how to log in and brows directories.  It seams to have limited capabilities.  I tried using the 29mar snapshot, 20mar snapshot, and am about to try 10mar snapshot.  I have this dhcp error in all of these versions.  I'm trying to fix the 20mar version now with little luck.  Any Goo-rues out there?

    Thanks,
    -V



  • Ok,  My SSH issues were a result of not rebooting.  I made the correction and uploaded the file via FTP over SSH and it works fine.  The file you want to modify is services_DHCP.php

    Tell me how it goes

    Good luck,
    -V



  • i fixed /usr/local/www/services_dhcp.php
    "edit file" instrument correctly saved file to /usr/local/www directory.

    now all works good. thanks for help.


Log in to reply