How to match part of agent's vendor specific suboption

Eduardo Ferreira Juca de Castro jucah at cpqd.com.br
Tue Oct 11 14:18:07 UTC 2011


Thanks agian Glenn.

I changed the config so it's now:

option space vendor1;
option vendor1-encapsulation code 82 = encapsulate vendor1;
option vendor1.node code 1 = string;
option vendor1.vlan code 2 = string;
option vendor1.radio code 3 = string;
option vendor1.ssid code 4 = string;
option vendor1.gps code 5 = string;

log (info, concat("agent: ", option.vlan));

The idea with the log statement is to test if the server is deconding the
suboption correctly before try to match anything.

But nothing is being logged.
When I tried to define just one option (option vendor1.node code 9 = string)
just "agent :" is logged.

Actually the vendor description is:
OptID 82
len 87
subopt ID 9
len 85
Enterprise Num 0x0 0x0 0x99 0x99
total_len 80
# Sub ID 1: node mac, in string
subID 1
len 17
value 00:00:00:00:00:00
# Sub ID 2: VLAN string
subID 2
len 8
value VLAN0999
# Sub ID 3: radio mac, in string
subID 3
len 17
value 00:00:00:00:00:00
# Sub ID 4: SSID name string
subID 4
len 8
value opt82Vlan
# Sub ID 5: GPS coordinate string
subID 5
len 17
value 88.169472,77.338944

Seems that the server are not recognizing the supotions inside the option
82.
Is there a way to reference the whole option 82 so I can use substring to
get each value?

[]
Eduardo F. J. de Castro
CPqD - Telecommunications and IT R&D Center



2011/10/10 Glenn Satchell <glenn.satchell at uniq.com.au>

> ok, so you still need to say "option agent ...".
>
> However, you can define your own option space where you specify the
> sub-options and dhcpd will unpack them for you. See the dhcp-options man
> page under "ENCAPSULATION". This will look at option numbers and string
> length, so it will work in a much more generic way, eg your assumption that
> the length of the string is always 5, and previous options always finish
> before position 60.
>
> It will be something like this (note I haven't tested this so it might need
> some adjustments). In the second line, code 9 refers to the sub-option code
> number. In the third line code 82 refers to the encapsulated option number.
>
>     option space my-agent;
>     # decode as many sub-options here as required, one per line
>     option my-agent.ssid code 9 = text;
>
>     # encapsulate these in one option
>     option my-agent-encapsulate code 82 = encapsulate local;
>
>     # use it like this
>     match if (option my-agent.ssid = "SSID1");
>
> regards,
> -glenn
>
>
> On 10/10/11 22:36, Eduardo Ferreira Juca de Castro wrote:
>
>> Thanks Glenn,
>>
>> But I need to match a vendor specific suboption. The ones you listed
>> isn't in the packet.
>> I'll handle just one vendor dhcp relay though, so I know the order the
>> suboptions are packed.
>> If I can't use the global agent how to get access to the vendor specific
>> suboptions?
>>
>> []
>> Eduardo F. Jucá de Castro
>> CPqD - Gerência de Serviços e Aplicações Multimídia
>> Tel.: +55 19 3705-7238 / Fax: +55 19 3705-5868
>> Cel.: +55 19 9603-4624
>> jucah at cpqd.com.br <mailto:jucah at cpqd.com.br>
>> www.cpqd.com.br <http://www.cpqd.com.br>
>>
>>
>>
>> 2011/10/9 Glenn Satchell <glenn.satchell at uniq.com.au
>> <mailto:glenn.satchell at uniq.**com.au <glenn.satchell at uniq.com.au>>>
>>
>>
>>    See man dhcp-options, I think you need to specify one of
>>
>>    option agent.circuit-id
>>    option agent.remote-id
>>    option agent.DOCSIS-device-class
>>    option agent.link-selection
>>
>>    You definitely need the "option" key word, otherwise it uses a variable
>>    named "agent" which is probably null.
>>
>>    Using substring on the whole agent field may not extract it
>>    correctly, as
>>    the order of packing in the sub options could vary.
>>
>>    regards,
>>    -glenn
>>
>>     > I'm using a similar statement to match PXE clients (to
>>    differentiate from
>>     > when installed systems boot - the PXE boot rom sends a specific
>>    client
>>     > option, and we had out different settings to these clients...
>>    works on
>>     > dhcp 3.0.x and 4.2.x (tested) - seems similar to what you want,
>>    it might
>>     > help.. here's the config block (actual IP replaced with 1.2.3.4
>>    in this
>>     > example):
>>     >
>>     >
>>     >
>>     > class "PXE" {
>>     >         match if substring(option vendor-class-identifier, 0, 9) =
>>     > "PXEClient";
>>     >         filename "pxelinux.0"
>>     >         option vendor-class-identifier "PXEClient";
>>     >         vendor-option-space PXE;
>>     >         option PXE.mtftp-ip 0.0.0.0;
>>     >         next-server 1.2.3.4;
>>     > }
>>     >
>>     > sounds like you might need the 'option' keyword before 'agent' to
>>    match
>>     > what you're looking for?
>>     >
>>     >
>>     >
>>     > ====================
>>     >
>>     > Scott Stone <scott_stone at trendmicro.com
>>    <mailto:scott_stone@**trendmicro.com <scott_stone at trendmicro.com>>>
>>
>>     > Manager, DCS-RD
>>     > Trend Micro, Inc. http://www.trendmicro.com
>>     >
>>     >
>>     >
>>     > From: dhcp-users-bounces+scott_**stone=trendmicro.com at lists.**
>> isc.org <trendmicro.com at lists.isc.org>
>>    <mailto:trendmicro.com at lists.**isc.org <trendmicro.com at lists.isc.org>>
>>     > [mailto:dhcp-users-bounces+**scott_stone<dhcp-users-bounces%2Bscott_stone>
>>    <mailto:dhcp-users-bounces%**2Bscott_stone<dhcp-users-bounces%252Bscott_stone>
>> >=trendmicro.com@**lists.isc.org <trendmicro.com at lists.isc.org>
>>    <mailto:trendmicro.com at lists.**isc.org <trendmicro.com at lists.isc.org>>]
>> On
>>
>>     > Behalf Of Eduardo Ferreira Juca de Castro
>>     > Sent: Sunday, October 09, 2011 12:07 PM
>>     > To: dhcp-users at lists.isc.org <mailto:dhcp-users at lists.isc.**org<dhcp-users at lists.isc.org>
>> >
>>
>>     > Subject: How to match part of agent's vendor specific suboption
>>     >
>>     >
>>     >
>>     > Hi,
>>     >
>>     >
>>     >
>>     > I need to assign addresses based on a ssid information carried on
>>    agent's
>>     > (option 82) vendor specific suboption.
>>     >
>>     > Do do so I defined classes this way:
>>     >
>>     > class "myClass" {
>>     >     match if substring(agent,60,5) = "SSID1";
>>     > }
>>     >
>>     > and used it in pool statements but nothing happens.
>>     >
>>     > I also tried to log things to see waht are beeing decoded but again
>>     > nothing happens.
>>     >
>>     > if option dhcp-message-type = 1 {
>>     >
>>     >     log(info,concat("option82-**suboption9:
>>     > ",binary-to-ascii(16,8,"",**substring(agent,60,5))));
>>     >
>>     > }
>>     >
>>     >
>>     >
>>     > I'm using ISC DHCP 4.2.1.
>>     >
>>     > Anyone can help me with this?
>>     >
>>     >
>>     >
>>     > TIA
>>     >
>>     >
>>     >
>>     > Regards,
>>     >
>>     >
>>     >
>>     >
>>     > Eduardo F. J. de Castro
>>     >
>>     > CPqD - Telecommunications and IT R&D Center
>>     >
>>     >
>>
> ______________________________**_________________
> dhcp-users mailing list
> dhcp-users at lists.isc.org
> https://lists.isc.org/mailman/**listinfo/dhcp-users<https://lists.isc.org/mailman/listinfo/dhcp-users>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20111011/d85bb9a0/attachment.html>


More information about the dhcp-users mailing list