Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Fixed DHCP bug!

    Scheduled Pinned Locked Moved 2.0-RC Snapshot Feedback and Problems - RETIRED
    11 Posts 6 Posters 6.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      thxer
      last edited by

      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;

      1 Reply Last reply Reply Quote 0
      • E
        Efonnes
        last edited by

        An example of what this fixes?

        1 Reply Last reply Reply Quote 0
        • T
          thxer
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • E
            Efonnes
            last edited by

            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.

            1 Reply Last reply Reply Quote 0
            • K
              kingjedi
              last edited by

              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

              1 Reply Last reply Reply Quote 0
              • E
                Efonnes
                last edited by

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

                1 Reply Last reply Reply Quote 0
                • jimpJ
                  jimp Rebel Alliance Developer Netgate
                  last edited by

                  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.

                  Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                  Need help fast? Netgate Global Support!

                  Do not Chat/PM for help!

                  1 Reply Last reply Reply Quote 0
                  • P
                    psi
                    last edited by

                    @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

                    1 Reply Last reply Reply Quote 0
                    • ?
                      Guest
                      last edited by

                      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

                      1 Reply Last reply Reply Quote 0
                      • ?
                        Guest
                        last edited by

                        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

                        1 Reply Last reply Reply Quote 0
                        • P
                          psi
                          last edited by

                          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.

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post
                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.