Can you add a class match with omshell?

Glenn Satchell Glenn.Satchell at uniq.com.au
Fri Jan 9 05:27:21 UTC 2009


>Date: Fri, 09 Jan 2009 02:32:50 +0200
>From: Oleg Gawriloff <barzog at telecom.by>
>To: dhcp-users at lists.isc.org
>Subject: Re: Can you add a class match with omshell?
>
> >The problem with this workaround is that subclasses allocate a hash
> >table to hold the subclass lookups in, into which you're only going
> >to place one element per class.  It will use an extraordinary amount
> >of memory unless you alter the sources (look in includes, there are a
> >series of default hash sizing #defines).
> >Note that you're already chasing a performance spectre because you're
> >supposing a large number of class statements.  The classes are
> >searched linearly (linear search on subclasses, hash search on a
> >per-class-basis for subclass matches).  So you're looking at an O(n)
> >scaling CPU sponge at the very start of all DHCP packet processing.
>After some brain-storming, keeping your words about linear search in 
>mind, we come to the point that we don't need realy chaining Option82 
>(Switch+Port) to some fixed address/class. All we need: that in any 
>moment of time our BSS must know what ip address belongs to which client 
>(switch+port). Of course one solution is generate huge amount of static 
>classess as I ask earlier. But another solution to implement some kind 
>of interaction beetween dhcpd and BSS during dhcp address request. After 
>some reading I'll come to followind config (which for me eliminates need 
>for static classess):
>
>on commit or release or expiry
>{
>         set portid=pick-first-value(binary-to-ascii(10,8,".",option 
>agent.circuit-id),"0");
>         set switchid=pick-first-value(binary-to-ascii(10,8,".", option 
>agent.remote-id),"0");
>         set clientip=binary-to-ascii (10, 8, ".", leased-address);
>         set clientmac=binary-to-ascii(16,8,".",substring(hardware,1,100));
>         set relayip="0";
>execute("/root/bin/dhcpd-accounting.pl","REQUEST",switchid,portid,clientip,rela
yip,clientmac);
>}
>
>After this I wrote small script that convert all params to standard 
>RADIUS Accouting request which our BSS kindly accepts. Only two question 
>sremains:
>1. in scripts params I want to include giaddr of relay agent, but I 
>can't find isc-dhcpd option for this field (giaddr). Any ideas/suggestion?
>2. man about 'execute' says that its blocking operation. My script run 
>in about 1 second. Does at means that any dhcp packets that comes to 
>server at this moment will be discarded or some kind buffering is in place?

You could write a wrapper script that returns quickly, eg replace the
execute line with:

execute("/root/bin/wrapper.sh","REQUEST",switchid,portid,clientip,relayip,client
mac);

and /root/bin/wrapper.sh contains:

#! /bin/sh
/root/bin/dhcpd-accounting.pl "$1" "$2" "$3" "$4" "$5" "$6" &

This will return very quickly. You may need to add some locking, etc,
to your script now in case it can't handle multiple simultaneous
updates.

regards,
-glenn




More information about the dhcp-users mailing list