[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in CheckNetAssigned with Fix.

On Friday 29 March 2002 14:26 pm, you wrote:

> Would cause strange behafiour in allocations etc because
> If a subnet had just had 1 allocatted subnet in it, it would
> return as if it had nothing allocated in it.

Well.. look's like you opened a Pandora's Box on me!! ;-)

The CheckNetAssigned function was totally braindead.  The original reason for 
it was to find any blocks currently in the db that were smaller then a given 
block.. example..


The original function when called with the block '' should have 
return non-zero because exists (it actually returns the 
number of blocks that are their or zero).  This was to keep the Alloc Wizard 
and the 'Subnet' add functions from returning blocks that already had smaller 
blocks in the db.

Well.. turns out there was a CheckNetSmallerExist function that is supposed 
to do this, so not only did was CheckNetAssigned broken, CheckNetSmallerExist 
was also their and also broken.  To make things more confusing 
CheckNetSmallerExist was not even being used by anything!

So... the fix.. i've removed CheckNetAssigned and fixed CheckNetSmallerExist 
to work right.  The calls to CheckNetAssigned have been changed to 
CheckNetSmallerExist and all appears to be working a lot better..

Phew.. this is too much for a Friday!! ;-)

The fix is in CVS and I hope this nails it down.  Give it a run and see if 
this is the correct behaviour.

| Hitesh Patel                    |  Lead Developer            |
| hitesh@presys.com               |  NorthStar                 |
| NorthStar: http://www.brownkid.net/NorthStar/                |
| PGP Key:   http://www.brownkid.net/pgpkey.asc                |