execute problems

David W. Hankins David_Hankins at isc.org
Fri Sep 22 17:06:07 UTC 2006


On Mon, Sep 18, 2006 at 04:58:41PM +0200, Jon Otterholm wrote:
> I'm trying to use the new "execute" function in isc-dhcpd-V3.1.0a1 with 
> not all good results.

Well, this was a submitted patch, I don't know a lot about it, so take
this with a grain of salt.

> on commit {
>   set hostip = binary-to-ascii(10,8,".", leased-address); set hostmac = 
> binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
>   if (execute ("/usr/scripts/test2.sh", hostip)) = 0) {
>     log (concat ("Firewall updated with new client ", hostip, " ", 
> hostmac));
>   } else {
>     log (concat ("Error while updating firewall with client ", hostip, " 
> ", hostmac));
>   }
> }

I assume you're seeing a value for 'hostip' and 'hostmanc' on the
leases in question (or else null values would be pretty obvious).

On a hunch, try placing the binary-to-ascii() calls directly inside
the execute() arguments instead of using the binding scopes.

> I allso have problems with logging of MAC when there are zeros in the 
> address - they are all left out. For example 0a:0b:0c:0d:0e:0f becoms 
> a:b:c:d:e:f in the logfile.

This is unfortunately an intentional design.

-- 
ISC Training!  October 16-20, 2006, in the San Francisco Bay Area,
covering topics from DNS to DDNS & DHCP.  Email training at isc.org.
-- 
David W. Hankins	"If you don't do it right the first time,
Software Engineer		you'll just have to do it again."
Internet Systems Consortium, Inc.	-- Jack T. Hankins


More information about the dhcp-users mailing list