problems with log and options that are set.

Hughes, Doug Douglas.Hughes at
Thu Oct 10 14:04:54 UTC 2013

Yeah, that works! But it points out that I have hit yet another dead-end. I can't use a variable that I construct as a host-identifier to provide a fixed address to the client.. I've been battling this for a week now and am becoming more convinced by the day that you just can't get there from here with the current dhcpd.

(background: I'm trying to use DHCP option 82 to assign fixed IP address to any device that asks for an address on a specific port on a switch, and agent.circuit-id is not globally unique, but  a combination of agent.remote-id and agent.circuit-id would be. Unfortunately, there doesn't appear to be any way to concatenate them at the server and use that as a reference to assign a fixed IP or pool of 1. Hostidentifier allows 'option <any option>' but does not allow option <config-option> <...>)

From: at [ at] On Behalf Of Michal Kostenec
Sent: Thursday, October 10, 2013 2:07 AM
To: Users of ISC DHCP
Subject: Re: problems with log and options that are set.

Hi Doug,
try change directive 'option' to  'config-option' in log function:

log (info, concat ("DHCPAGENT assigning user-class1: ", config-option porthash));


On 9. 10. 2013, at 20:25, "Hughes, Doug" <Douglas.Hughes at<mailto:Douglas.Hughes at>> wrote:

Shouldn't it work to set an option and then log what was set? Or to set any arbitrary (temporary) variable that you've created? I want to dynamically build a variable and then use that for the host identifier match to hand out a fixed address based upon the agent.remote-id *AND* agent.circuit-id.

I see from googling for the last week that a lot of people have tried this with varying degrees of hackishness and success since the dhcpd doesn't support this directly. I've tried subclassing, but you can't do an allow from a subclass for a pool of 1 IP (another hack). I've even looked at patches released in the past for this problem.

But, back to the specific problem, one of debugging.

Take this statement:
option porthash code 214 = text;

if exists agent.circuit-id
        if option agent.circuit-id ~= ":" {
                log (info, concat ("DHCPAGENT ", "stuff"));
                log (info, concat ("DHCPAGENT lease of ", binary-to-ascii (10,8, ".", leased-address), " for agent ", option agent.remote-id, " on ", option agent.circuit-id));
                option porthash = concat(substring(option agent.remote-id,0,10), "_", substring(option agent.circuit-id, 0, 10));
                log (info, concat ("DHCPAGENT assigning user-class1: ", option porthash));
                log (info, concat ("DHCPAGENT assigning user-class2: ", option agent.remote-id, "_", option agent.circuit-id ));
                log (info, concat ("DHCPAGENT", " post"));

It prints:
DHCPAGENT lease of for agent s55-test on 53:0:26
DHCPAGENT assigning user-class2: s55-test_53:0:26

I have proven (to myself at least) that:
*         the concatenation of agent.remote-id "_" and agent.circuit-id is a string.
*         The above string will log correctly
*         If I use any option (pre-existing, or defined. I have tried this with dhcp-client-identifier which is pre-defined) the log will fail, silently
*         If I use any temporary variable in the log statement that I assign instead of the porthash example above, it will fail.

Can anybody explain what is going on with the silent failure of the log statement? Why doesn't it log? Why doesn't it generate any error or output at all about the failure
Of the log?  This makes debugging quite difficult...


dhcp-users mailing list
dhcp-users at<mailto:dhcp-users at>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the dhcp-users mailing list