Loggin option 82 AID and CID

Glenn Satchell glenn.satchell at uniq.com.au
Wed Jun 30 00:26:36 UTC 2010


Not that I'm directly aware of. You could read through the dhcp-eval man 
page to see if there is something there. There doesn't seem to be a 
length() operator, nor does substring() take, say, a negative number to 
indicate measure from the end of the string.

In the general case there is no direct solution - the agent-id and 
remote-id can contain arbitrary data, so it's not necessarily enough to 
just drop the last byte (even though this seems to work in your case). 
The suggestion I made prints the string as hex bytes, which can print 
any string. I realise it's not very human friendly.

regards,
-glenn

On 06/30/10 01:18, Blake Griffin wrote:
> Is there anyway to filter that out without having to know the exact
> substring size?
>
> -----Original Message-----
> From: dhcp-users-bounces+blake=ccfargo.com at lists.isc.org
> [mailto:dhcp-users-bounces+blake=ccfargo.com at lists.isc.org] On Behalf Of
> Glenn Satchell
> Sent: Monday, June 28, 2010 9:15 PM
> To: Users of ISC DHCP
> Subject: Re: Loggin option 82 AID and CID
>
> Hi Blake
>
> There could be a null or unprintable char in the remote-id or agent-id
> strings. You could test this by using binary-to-ascii to decode that
> string so you could see all the values, eg:
>
> pick-first-value(binary-to-ascii(8,8,":", option agent.remote-id),
> "---"),
>
> Remote-id and agent-id are defined by the forwarding equipment, and do
> not have to be printable ascii strings.
>
> regards,
> -glenn
>
> On 06/29/10 11:38, Blake Griffin wrote:
>> Ran into a problem logging AID and CID information using the
> following:
>>
>> on commit
>>
>> {
>>
>> log (info, concat(
>>
>> "==>  STB Lease ",binary-to-ascii(10, 8, ".", leased-address),
>>
>> " from MAC ",binary-to-ascii(16,8,":",substring(hardware,1,6)),
>>
>> " (",pick-first-value(option host-name,"---"),")",
>>
>> " assigned to AID: ",pick-first-value(option agent.remote-id,"---"),
>>
>> " CID: ",pick-first-value(option agent.circuit-id,"---"),
>>
>> " has committed"
>>
>> ));
>>
>> }
>>
>> This should result in a log message like this:
>>
>> ==>  DATA Lease 206.10.75.27 from MAC 0:30:18:b0:dd:74 (AMBER-NEW)
>> assigned to AID: N1-2-8-1-1-OntEth1-1 CID: n1-1-vb11-464-vlan10 has
>> committed
>>
>> However it does not. It ends after the AID entry unless I put in a
>> substring statement with the exact number of characters. I then also
>> have to do this for the CID as well to get the whole statement. The
>> problem with this is that I believe the agent.remote-id and
>> agent.circuit-id are variable. Can anyone explain to me this behavior
>> and give me any direction on correcting it?
>>
>> Thanks,
>>
>> Blake



More information about the dhcp-users mailing list