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

Somethinf missing in classifier-bst.cc



Hi all,

I had some problems using BST.tcl and I found out that the problem came
from the following function in classifier-bst.cc.

upstream_info* MCastBSTClassifier::upstream_find(int dst)
{
	upstream_info *index;

	index = oif2RP_;
	while (index) {
		if (index->dst == dst) 
			return index;
	} // while
	return NULL;
} // MCastBSTClassifier::upstream_fin

If the "if" test fails it's gonna loop indefinitely. as I saw in the
"upstream_info" structure, I thaught it was more likely that the
following will be correct :

upstream_info* MCastBSTClassifier::upstream_find(int dst)
{
	upstream_info *index;

	index = oif2RP_;
	while (index) {
		if (index->dst == dst) 
			return index;
		else
			index = index->next ;
	} // while
	return NULL;
} // MCastBSTClassifier::upstream_fin

I tested it, and it is working.

Cheers,
Abdelhamid JOUMDANE