Menu

#5028 DHCP client options defined as integers are quoted and make DHCP server unable to start

1.850
open
nobody
5
2020-08-30
2017-10-12
bajobongo
No

Client options defined as (arrays of) integers are quoted for hosts (if hosts are defined in separated files), i.e.
dhcpd.conf contains:

...
option option-246 code 246 = string;
option tftp-server-address code 150 = array of ip-address;
option option-131 code 131 = { ip-address , unsigned integer 16 , unsigned integer 8 };
...
include "/etc/dhcp/host1.conf";
include "/etc/dhcp/host2.conf";
include "/etc/dhcp/host3.conf";

Example of host3.conf is:

host host_3 {
 option option-131 "237.7.7.7 22222 10"; # <-- QUOTED (INCORRECT!)
 option option-246 "some string";
 fixed-address 192.168.1.103;
 hardware ethernet xx:xx:xx:xx:xx;
}

Problem observed on Ubuntu 16.04 (x64) and isc-dhcp

Discussion

  • bajobongo

    bajobongo - 2017-10-12

    I've checked and the fact that host is defined in separate file doesn't matter.

     
  • Jamie Cameron

    Jamie Cameron - 2017-10-13

    Have you tried to upgrading to Webmin 1.860? It should fix this.

     
  • bajobongo

    bajobongo - 2017-10-17

    Yes, and it didn't fix.

     
  • Robert Falkenberg

    The issue still happens with version 1.953 on Ubuntu 16.04.4 with ISC DHCPd version 4.3.3

    I am wondering about the existence of this bug, since it should have been fixed already in [#4664] from 2015 and in [#4777] later in 2016.

    Steps to reproduce:

    I manually define the following options in dhcpd.conf by directly editing the file:

    option rfc3442-classless-static-routes code 121 = array of integer 8;
    option ms-classless-static-routes code 249 = array of integer 8;
    

    and later

                    option rfc3442-classless-static-routes 19 , 172 , 27 , 0 , 10 , 20 , 30 , 40;
                    option ms-classless-static-routes 19 , 172 , 27 , 0 , 10 , 20 , 30 , 40;
    

    (values are changed for this bug report)
    Subsequently, after viewing those options in Webmin under "Servers > DHCP Server > [a network range] > Edit Client Options", I can see those custom options and their arguments.
    However, after pressing "Save", these arguments are enclosed by parentheses in the config file, as follows:

                    option rfc3442-classless-static-routes "19 , 172 , 27 , 0 , 10 , 20 , 30 , 40";
                    option ms-classless-static-routes "19 , 172 , 27 , 0 , 10 , 20 , 30 , 40";
    

    Finally, the DHCP service fails to start due to incorrect syntax: Number expected.

    Note: Changing "integer" to "unsigned integer" makes no difference.

     

    Related

    Bugs: #4664
    Bugs: #4777


    Last edit: Robert Falkenberg 2020-07-15
  • Jamie Cameron

    Jamie Cameron - 2020-07-18

    Just re-tested this with Webmin 1.953, and was unable to reproduce the problem. Unless you're editing a value that is already quoted in dhcpd.conf, in which case Webmin will try to preserve it.

     
  • Robert Falkenberg

    Hi,
    thanks for the reply!

    I'm on exactly the same version: 1.953. (Ubuntu Linux 16.04.4, Linux 4.4.0-174-generic on x86_64)

    Did you check the newly written file "dhcpd.conf" after viewing the "Edit Client Options" and after pressing "Save"? (without changing any field)

    Whether before of after pressing "save" - the textfield in Webmin's GUI always shows the values without quotation. However, the argument in the output file will be quoted after the first press of "save".

     
  • Robert Falkenberg

    Just made some more tests and found something:

    In my example, the part with

    option rfc3442-classless-static-routes code 121 = array of integer 8;
    option ms-classless-static-routes code 249 = array of integer 8;
    

    ist located in global scope within dhcpd.conf, while the second part is nested inside subscopes as follows:

    shared-network NAME {
        ...
        subnet x.y.z.zz netmask 255.255.255.0 {
                    ...
                    option rfc3442-classless-static-routes 19 , 172 , 27 , 0 , 10 , 20 , 30 , 40;
                    option ms-classless-static-routes 19 , 172 , 27 , 0 , 10 , 20 , 30 , 40;
                    ...
        }
    }
    

    If I move those routes up into the global scope, the output is correct and not quoted by the Webmin.

    Is this behaviour intended?

     
  • Robert Falkenberg

    Hello,

    as I said in my last post, if I move the following options

    shared-network NAME {
        ...
        subnet x.y.z.zz netmask 255.255.255.0 {
                    ...
                    option rfc3442-classless-static-routes 19 , 172 , 27 , 0 , 10 , 20 , 30 , 40;
                    option ms-classless-static-routes 19 , 172 , 27 , 0 , 10 , 20 , 30 , 40;
                    ...
        }
    }
    

    into the global scope, Webmin handles the arguments correctly and performs no unintended quoting.

    However, since my dhcpd.conf covers multiple subnets, I cannot simply define the static route in the global scope for all networks.

    I also tried the opposite way and moved the part with

    option rfc3442-classless-static-routes code 121 = array of integer 8;
    option ms-classless-static-routes code 249 = array of integer 8;
    

    into the subnet definition. While this is also fine for Webmin (no unintended quoting), the ISC DHCP fails to start and complains about

    Aug 18 15:48:57 corerouter-ng dhcpd[31562]: /etc/dhcp/dhcpd.conf line 50: option definitions may not be scoped.
    Aug 18 15:48:57 corerouter-ng dhcpd[31562]: option rfc3442-classless-static-routes code
    ...
    Aug 18 15:48:57 corerouter-ng dhcpd[31562]: /etc/dhcp/dhcpd.conf line 52: unknown option dhcp.rfc3442-classless-static-routes
    ...
    Aug 18 15:48:57 corerouter-ng dhcpd[31562]: Configuration file errors encountered -- exiting

    So this is not an option.
    Is there any possibility to teach Webmin to inherit these two global options to the nested scope of "shared-network" and "subnet" in order to provide a proper (unquoted) treatment of the numeric arguments?

    Best Regards
    Robert

     

    Last edit: Robert Falkenberg 2020-08-18
  • Jamie Cameron

    Jamie Cameron - 2020-08-22

    That's surprising, because Webmin shouldn't treat option definitions any differently regardless of which scope their they are in.

    Would it be possible to get a copy of your entire dhcpd.conf file? You can email it to jcameron@webmin.com

     

Log in to post a comment.