To add some filter rules in conf file

Jeff Haran jharan at Brocade.COM
Tue Oct 20 00:20:55 UTC 2009


> -----Original Message-----
> From: dhcp-users-bounces at lists.isc.org 
> [mailto:dhcp-users-bounces at lists.isc.org] On Behalf Of Simon Hobson
> Sent: Monday, October 19, 2009 11:22 AM
> To: Users of ISC DHCP
> Subject: Re: To add some filter rules in conf file
> 
> Quoting (especially top posting) fixed !
> 
> Ashmath Khan wrote:
> 
> >>I do have one last idea, though if it will work or not I don't 
> >>know. If you check "man dhcp-eval" you'll find there is an "if ... 
> >>elseif ... else" mechanism. I could see the possibility of using 
> >>this to set a variable to say how far a client matched your 
> >>sequential list of tests - so you could drop out the test with a 
> >>variable set to "r1", "r2" etc. Then configure your classes with 
> >>match if <somevariable> = "r1" and so on.
> 
> >Sorry, I can't make out much from this.
> 
> OK, taking the example given by Jeff Haran :
> 
> rule 1: If its red, use the red pool, else
> rule 2: If its fat, use the fat pool, else
> rule 3: If its tall, use the tall pool, else
> rule 4: Use the cold pool
> 
> You'd express this in terms of :
> If it's Red, then set kind:=red
> Elseif it's fat, then set kind:=fat
> Elseif it's tall, then set kind:=tall
> Else, set kind:=cold
> 
> Then you'd have classes like this :
> Class "red" { match if kind="red" ; ...}
> Class "fat" { match if kind="fat" ; ...}
> Class "tall" { match if kind="tall" ; ...}
> Class "cold" { match if kind="cold" ; ...}
> 

Well, actually I was thinking more along the lines of the following (my apologies if I've mangled the syntax, just trying to illustrate a point here):

class "red" {
	match if (option color = "red");
}

class "fat" {
	match if (option color != "red") && (option weight = "fat");
}

class "tall" {
	match if (option color != "red") && (option weight != "fat") && (option height = "tall");
}

class "cold" {
	match if (option color != "red") && (option weight != "fat") && (option height != "tall");
}

	...
	pool {
		range 10.0.0.1 10.0.0.254;
		allow members of "red";
	}
	pool {
		range 10.0.1.1 10.0.1.254;
		allow members of "fat";
	}
	pool {
		range 10.0.2.1 10.0.2.254;
		allow members of "tall";
	}
	pool {
		range 10.0.3.1 10.0.3.254:
		allow members of "cold";
	}
	...

No variables required, I think.

Jeff Haran
Brocade



More information about the dhcp-users mailing list