|
From: Philippe T. <phi...@gm...> - 2008-01-25 14:07:07
|
Hi,
I needed to use option 122 (DOCSIS) in my DHCPD.conf and it appears that
Webmin had some problem with DHCPD syntax to write it. It hangs the parser,
giving me an almost empty page instead of my subnets and groups.
Here are the lines in the dhcpd.conf :
option space docsis-ccc;
option docsis-ccc.dhcp-server-1 code 1 = ip-address;
option docsis-ccc.dhcp-server-2 code 2 = ip-address;
option docsis-ccc.provision-server code 3 = { integer 8, string }; ## hangs
option docsis-ccc.krb-realm-name code 6 = string;
option docsis-ccc code 122 = encapsulate docsis-ccc; ## misunderstood
Two of those line are misunderstood by Webmin dhcpd's module
* The 4th line is the one which hangs the parser. It defines a record (int
8, string) as the type of the "provision server suboption". And webmin does
not like it.
For the moment, I just commented out this line as I do not user the
provision server parameter.
* The last line, with the encapsulate type, is also misunderstood, but does
not hang the code. Instead, webmin will parse and silently forget
encapsulate's parameter (here docsis-ccc). After a "client optiont" change
in webmin, the dhcpd.conf will contain "option docsis-ccc code 122 =
encapsulate;" and then DHCPD's parser will hang (cause this is a syntax
error).
(more about this option syntax by the end of this document
http://www.linuxmanpages.com/man5/dhcp-options.5.php)
I wrote a fast hack for that 2nd problem in order to prevent users from
crashing dhcpd.
[root@localhost dhcpd]# diff edit_options.cgi.Before_patch edit_options.cgi
168,169c168,176
< printf "<input name=dtype_$i size=10 value='%s'>\n",
< $o->{'values'}->[4];
---
> if ($o->{'values'}->[4] eq "encapsulate") {
> printf "<input name=dtype_$i size=10 value='%s'>\n",
> $o->{'values'}->[4]. " ".$o->{'values'}->[5];
>
> } else {
> printf "<input name=dtype_$i size=10 value='%s'>\n",
> $o->{'values'}->[4];
> }
>
[root@localhost dhcpd]# diff save_options.cgi.Before_patch save_options.cgi
116c116
< $in{"dtype_$i"} =~ /^[a-z0-9\.\-\_]+$/i ||
---
> $in{"dtype_$i"} =~ /^(encapsulate |)[a-z0-9\.\-\_]+$/i ||
I didn't found anything about this bug in the tracking system. It's the 1st
time I look at webmin's code, so I'll try to have a deeper look at it, and
achieve a better patch with support of encapsulate, records, and even arrays
which are also unsupported I can imagine.
--
Philippe Teissier
phi...@m4...
|