Question on pick-first-value and valid FQDN

Glenn Satchell glenn.satchell at uniq.com.au
Mon Oct 15 03:35:54 UTC 2012


On Sat, October 13, 2012 2:09 am, Jim Glassford wrote:
> Hi,
>
> Running DHCP Server 4.1.1-P1 and had a question on pick-first-value with
> dynamic dns updates. All working great doing ddns, using the ethernet
> address for wireless and student machines FQDN.
>
>
> subnet 10.10.118.0 netmask 255.255.254.0 {
>   option routers 10.10.118.1;
>    pool {
>    range 10.10.118.50 10.10.119.254;
>    default-lease-time 3600; max-lease-time 3600;
>    ignore client-updates;
>    ddns-updates on;
>    ddns-rev-domainname "in-addr.arpa.";
>    ddns-hostname =  binary-to-ascii (16, 8, "-",substring (hardware, 1,
> 6));
>    ddns-domainname "vcl.iup.edu";
>    }
> }
>
>
> Starting a VMware VDI scope and want to start creating the FQDN with the
> host name supplied by the VM clients. Considering the following, if host
> name supplied, use it, if not create one using the ethernet address.
> Same as above, just changed the ddns-hostname line to:
>
> ddns-hostname = pick-first-value ((option host-name), (binary-to-ascii
> (16, 8, "-",substring (hardware, 1, 6))));
>
>
>
> If invalid host name supplied, underscore, slash, etc, should I do more
> conditional evaluation of the supplied name or would an invalid supplied
> host name fail the evaluation, be considered a null value then move to
> the second choice?
>
> thanks!
> jim
>

pick-first-value() is not that smart. It returns the first non-null
option. SO as long as option host-name returns *anything* then that is
what will be returned. If you want to check for underscores or other
patterns then you'd need to check specifically for that.

Current versions can do regexp matching, so looking for an underscore is
not too hard.

Those type of operations are covered in the dhcp-eval man page.

regards,
-glenn




More information about the dhcp-users mailing list