[Dnsmasq-discuss] dhcp-option and vendor class
Simon Kelley
simon at thekelleys.org.uk
Mon Dec 29 13:20:38 GMT 2008
Ben wrote:
> Simon Kelley wrote:
>> Ben wrote:
>>> This works:
>>>
>>> dhcp-vendorclass=apc,APC
>>> dhcp-option=apc,43,01:04:31:41:50:43:02:01:01
>>>
>>> but this doesn't:
>>>
>>> dhcp-option=vendor:APC,43,01:04:31:41:50:43:02:01:01
>>>
>>> What am I missing here? Shouldn't the "vendor:APC" syntax work?
>>
>> It does work: it does the encapsulation for you, so you need
>>
>> dhcp-option=vendor:APC,01,31:41:50:43
>> dhcp-option=vendor:APC,02,01:01
>>
>> depending on what those options are, you may what to use a more
>> natural representation than hex bytes.
>>
>>
>> Your second example is taking the already-encapsulated options,
>> treating them as a single option and encapsulating them again, which
>> confuses things somewhat.
>>>
>>
>> Cheers,
>>
>> Simon.
>>
>>
>>
> Simon,
>
> Thanks for the reply but i am afraid i still don't get it.
>
> I pulled that string straight from the APC manual without knowing what
> it means. http://www.apcmedia.com/salestools/ASTE-6Z5QEW_R0_EN.pdf page
> 61/62.
>
> How would i go about representing it in a more natural way?
>
> Ben
>
Apolgies, I assumed too much in my first reply.
dhcp options are represented like this:
<option number> <length of data> <bytes of data>
packed together, with an 0xff option number to mark the end. The option
numbers are defined by IETF. Encapulated options is the IETF option
number 43, and the data part contains a complete set of options "nested"
inside it, but of course with the options numbers privately defined by
the vendor.
So your
dhcp-option=apc,43,01:04:31:41:50:43:02:01:01
will generate the byte-string (43 is 2b hex)
2b:09:01:04:31:41:50:43:02:01:01
and the encapsulated options in the data part are
01 (length 4) 31:41:50:43
02 (length 1) 01
Looking at the documentation, the APC is expecting the string "1APC" as
encapsulated option 1 and a flag which enables use of BOOTP or DHCP as
encapsulated option 2
so we can represnt these as
dhcp-option=vendor:APC,1,"1APC"
dhcp-option=vendor:APC,2,1b
The "b" after the one tells dnsmasq that the integer "1" is to be
represented as a single byte. (It knows this stuff for IETF options, but
not for privately defined ones)
dnsmasq will send these options only if the client send a vendor class
which matches "APC" and will gather them together withing an
encapsulating option 43 - just what you want.
HTH
Simon.
More information about the Dnsmasq-discuss
mailing list