[Maintain] Using names instead of numbers in DHCP config

Brandon Philips brandon at osuosl.org
Tue Apr 26 15:17:49 PDT 2005


Greg,


> We usually use names instead of numbers in the DHCP config file where
> possible.  This forces the DHCP server to do the lookup and hand out the
> correct IP number.  We do this so that we don't have to go and fiddle with
> each option every time something changes on our network... we just update the
> DNS (usually a CNAME) and we're good to go.  But, that introduces a dependency
> where the DHCP server may not give out the right info if it can't resolve
> the names properly.

For this reason I wish that they (ISC) would have made it a seperate
option, it would have made my life easier at least.

> Here is a quick patch to be able to put names instead of numbers in for
> "domain-name-servers".  I will probably do the same for "netbios-name-servers"
> as well...

Sounds good.

> Warning, the dhcp-options man page says that if you use a name instead of an
> IP address, you must make sure it maps to only one A record...

As I told Greg in #maintain, I would be interested if someone could
provide me a point in the source code or maybe some documentation on
what will happen to people who do not follow this warning.  


My only comment on the patch is that it is not necessary to instantiate
a new domain in order to call is_valid_domain.  I will make that change
when I apply the patch, so just FYI.


> (text below has weird spacing... see attachment for better version)
> maintain# diff -Naur modules/class/option.php.orig  modules/class/option.php
> --- modules/class/option.php.orig       2005-04-26 14:52:44.000000000 -0700
> +++ modules/class/option.php    2005-04-26 14:54:11.000000000 -0700
> @@ -153,7 +153,9 @@
>                         case 'routers':
>                                  $data = explode(",", $value);
>                                  foreach ($data as $ip_addr) {
> +                                       $domain = new Domain(0);
>                                         if (preg_match("/\%[hi]{1}/",trim($ip_addr))) { $valid = true; }
> +                                       if ( $domain->is_valid_name(trim($ip_addr)) ) { $valid = true; }
>                                         if (!$ip->is_dotted_quad(trim($ip_addr)) && !$valid) {
>                                                  $conf['error']->add_error('option_value', "Invalid Value, $dhcp_option format must be 10.0.0.0,10.0.0.1");

-bp

-- 
Brandon Philips
brandon at osuosl.org
"Open minds. Open doors. Open source." - osuosl.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.osuosl.org/pipermail/maintain/attachments/20050426/38339e43/attachment.pgp


More information about the Maintain mailing list