problems with log and options that are set.

Hughes, Doug Douglas.Hughes at DEShawResearch.com
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: dhcp-users-bounces+douglas.hughes=deshawresearch.com at lists.isc.org [mailto:dhcp-users-bounces+douglas.hughes=deshawresearch.com at lists.isc.org] 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));

Regards
Michal.


On 9. 10. 2013, at 20:25, "Hughes, Doug" <Douglas.Hughes at DEShawResearch.com<mailto:Douglas.Hughes at DEShawResearch.com>> 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 stuff
DHCPAGENT lease of 1.1.2.3 for agent s55-test on 53:0:26
DHCPAGENT assigning user-class2: s55-test_53:0:26
DHCPAGENT post


So:
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...

Thanks


_______________________________________________
dhcp-users mailing list
dhcp-users at lists.isc.org<mailto:dhcp-users at lists.isc.org>
https://lists.isc.org/mailman/listinfo/dhcp-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20131010/35ea2372/attachment-0001.html>


More information about the dhcp-users mailing list