Dealing with possible list of numeric option values (pxe-system-type)

glenn.satchell at uniq.com.au glenn.satchell at uniq.com.au
Mon Nov 16 06:36:19 UTC 2020


Hi Ross

Lists are encoded as a byte stream of concatenated values, so a list of 
int32 would be groups of 4 bytes, int16 as groups of 2 bytes, etc.

You might be able to use the regex match to pick a value in the 
subsequent byte stream, regex is defined in dhcp-eval as

data-expression-1 ~= data-expression-2

such as

if option pxe-system-type ~= 00:07 then ...

I haven't tested this, so you may want to verify my suggestion.

regards,
Glenn

On 2020-11-16 15:22, Boylan, Ross wrote:
> According to RFC 4578 and the dhcp-options man page, pxe-system-type
> has values that are a list of one or more uint16's. dhcp-eval and
> dhcp-options didn't seem to say exactly how I could work with it, or,
> more directly, what the result of using "option pxe-system-type" in a
> conditional expression is: a string? a number? a list?
> 
> My first guess was
> if option pxe-system-type = 7 then ....
> Should that work?  I notice all the examples on this list seem to use 
> the form
> if option pxe-system-type = 00:07 then ..
> suggesting the values are converted to a stream of bytes after
> promotion to 32 bit integer size.
> 
> Further, it sounds as if there might be multiple values supplied.  Is
> there any good way to figure if 7 is one of them?
> Will option pxe-system-type = 00:07 fail if there is more than one
> element returned, even if the first one is 7?
> Maybe in practice it is never an issue?
> 
> I'm also curious how options that are lists with elements other than
> numbers work.
> 
> Thanks.
> Ross Boylan
> cc's appreciated
> _______________________________________________
> ISC funds the development of this software with paid support
> subscriptions. Contact us at https://www.isc.org/contact/ for more
> information.
> 
> dhcp-users mailing list
> dhcp-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-users


More information about the dhcp-users mailing list