A few problems with DHCP



  • Hi -

    I've been testing some of the new options on DHCP, such as tftp server, and "Additional DHCP" Options.  I found a few problems:

    1)  If you add a "numbered option" and then delete it, so you have no more left, the DHCP config screen will crap out on line 312 in services_dhcp.php.  I think you're just missing a if (isset …)

    
    before:  
                   unset($config['dhcpd'][$if]['numberoptions']['item']);
    after:
                   if ( isset($config['dhcpd'][$if]['numberoptions']['item']))
                            unset($config['dhcpd'][$if]['numberoptions']['item']);
    
    

    the above seems to fix it.

    2)  some of the "numbered options" expect int32 or uint32, but it seems that the config always writes it as a string.  I haven't found where this happens yet.

    For instance to set tz offset in seconds, I'm east coast, so that would be -18000  DHCP option 2.    The config generated by the gui for this is below, but doesn't work:

    
    option domain-name "local";
    option ldap-server code 95 = text;
    option domain-search-list code 119 = text;
    option custom-opt-0 code 2 = text;
    
    default-lease-time 7200;
    max-lease-time 86400;
    log-facility local7;
    ddns-update-style none;
    one-lease-per-client true;
    deny duplicates;
    ping-check true;
    authoritative;
    subnet 172.16.10.0 netmask 255.255.255.0 {
            pool {
                    range 172.16.10.150 172.16.10.179;
            }
            option routers 172.16.10.1;
            option domain-name-servers 172.16.10.1;
            option ntp-servers 172.16.10.1;
            option tftp-server-name "172.16.10.70";
    
            option custom-opt-0 "-18000";
    }
    
    

  • Rebel Alliance Developer Netgate

    Good catch :)

    It would probably be best to open this up as a ticket in redmine ( http://redmine.pfsense.org ) and if possible, include a diff/patch.


Log in to reply