Execute Based Class Matching
p_latini at hotmail.com
Wed Jan 28 02:51:15 UTC 2009
David: Now I understand your point, yes when i was coding this patch i saw that that in the class evaluation all the class expresions are evaluated.
In the particular application that i was considering, only 4 classes were required and only two of them have "match if execute() =" (one for truth and other for false return) so the external script run time would be minimum.
However a more complex class configuration would not be much different that someone currently executing lot of plain execute statements within the classes, something that would have to be discouraged if performance is needed.
The problem i have seen with using subclasses for this is how flexible and dynamic the could be, for instance if I want to match agent.remote-id of an incoming packet with the hardware address of an existing client (subclass) to see if the packet is passing though a "known" device, i have two keep to subclass tables, one for the hardware of the device and other for the agent.remote-id of the client both containing virtually the same info.
With this approach, with small changes to the return parser (accept full strings instead of just integers) I could also could generate option anwers based on the external response, for instance hostnames with operator defined values or filenames with variable names. I consider this one really good extra feature that DHCPd could have and why shared this patch with the community.
Regading how to improve this, in order to reduce the number of execute() statements, i have been trying to make a set myvalue=execute(...); match if (myvalue=x); in the first subclass; and then if the following classes are related (that they use the same execute parameters), just do the match if (myvalue=x). I hava been getting some errors in the execution with that behaivor but i thing that it is easily doable. i will be focusing on that next week.
Thanks a lot!
> Date: Mon, 19 Jan 2009 11:30:58 -0800> From: David_Hankins at isc.org> To: dhcp-users at isc.org> Subject: Re: Execute Based Class Matching> > On Sat, Jan 17, 2009 at 05:56:15PM +0000, Patricio Latini wrote:> > What do you mean with subclasses? Do you think that i can give different parameters depending a subclass match?> > Classes are searched linearly, one at a time, each boolean executable> expression evaluated in series. Because a client can be a memory of> multiple classes, the list search is not aborted early on the first> match, so you don't even get any "N/2" averaging.> > Subclasses, on the other hand, are a hash table lookup, first> evaluating the key specified in the parent class 'match' clause,> and then hashing it to seek subclasses.> > I'm a bit fuzzy now on what you were looking to do with the classes,> but I had the understanding you might have a large number of class> structures. I was asking if you had given any thought to organizing> a large number of subclasses under a smaller number of classes.> > And yes, you can scope configuration inside the subclass.> > -- > David W. Hankins "If you don't do it right the first time,> Software Engineer you'll just have to do it again."> Internet Systems Consortium, Inc. -- Jack T. Hankins
Hotmail® goes where you go. On a PC, on the Web, on your phone.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the dhcp-users