Encapsulated match if

Olivier Bax de Keating olivier.baxdekeating.external at aastra.com
Wed Mar 5 13:38:52 UTC 2008


Hi,

I wanted to know if it's possible for dhcpd to check if a given parameter is requested by the client, this means : if a given option code is in the option 55 (Options Request List parameter). I can't use substring because I don't know in which order the options will appear)

Examples :
Option 55 presented by device 1: {1,3,60,66,67}
Option 55 presented by device 2: {1,3,60,67}

If I want to make a class of devices which request option 67, I don't know which function to use to do this, and if it's possible.

If an isInArray function existed, here is what I'd like to do.

class "Device1" {
    match  if isInArray(option dhcp-parameter-request-list, 67);
}

If you've got any ideas ...

Thx For all

Olivier

PS :

For my previous pb, I'm gonna try smthg like that : 

class "Device1" {
    if substring    (option  vendor-class-identifier, 0, 15) = "Name of Device1"{
	       #tells the DHCP server to use options in the DEVICE1 option space
		vendor-option-space DEVICE1;
    }
    match  if  substring    (option DEVICE1.suboption1, 0, 4) = "value1");
}


-----Message d'origine-----
De : dhcp-users-bounce at isc.org [mailto:dhcp-users-bounce at isc.org] De la part de Simon Hobson
Envoyé : mardi 4 mars 2008 12:07
À : dhcp-users at isc.org
Objet : Re: Encapsulated match if

Olivier Bax de Keating wrote:

>In each classes, I put 2 "match if", and I know 
>that this syntax is probably not correct. I'm 
>searching for the good one, I mean, a way to 
>encapsulate 2 conditions of match, with "if Š" 
>if it exists, or subclasses (but it seems to me 
>that they are not done for that ?)


Have you checked 'man dhcp-eval' ?

Two features you probably want to look at :


AND : if match if ( condition 1 AND condition 2 )

Fairly obvious, matches if both conditions are true.


match-first-value : match-first-value ( expression 1, expression 2, ... )

Function that returns the first non-null value. 
So if expression 1 has a value then it is 
returned, but if it is null then expression 2 is 
returned, and so on. I'm not sure you need this, 
as I'm not entirely sure what the question is !



More information about the dhcp-users mailing list