fixed traffic selector redundancy removal code (not completely tested)

This commit is contained in:
Martin Willi 2007-03-06 20:55:19 +00:00
parent 69351da14d
commit 9de7540eee
2 changed files with 17 additions and 7 deletions

View File

@ -317,19 +317,28 @@ static linked_list_t *select_traffic_selectors(private_policy_t *this,
{
while (i2->iterate(i2, (void**)&ts2))
{
if (ts1 != ts2 && ts2->is_contained_in(ts2, ts1))
if (ts1 != ts2)
{
i2->remove(i2);
ts2->destroy(ts2);
i1->reset(i1);
break;
if (ts2->is_contained_in(ts2, ts1))
{
i2->remove(i2);
ts2->destroy(ts2);
i1->reset(i1);
break;
}
if (ts1->is_contained_in(ts1, ts2))
{
i1->remove(i1);
ts1->destroy(ts1);
i2->reset(i2);
break;
}
}
}
}
i1->destroy(i1);
i2->destroy(i2);
return selected;
}

View File

@ -7,7 +7,7 @@
/*
* Copyright (C) 2007 Tobias Brunner
* Copyright (C) 2005-2006 Martin Willi
* Copyright (C) 2005-2007 Martin Willi
* Copyright (C) 2005 Jan Hutter
* Hochschule fuer Technik Rapperswil
*
@ -30,6 +30,7 @@
#include "traffic_selector.h"
#include <daemon.h>
#include <utils/linked_list.h>
#include <utils/identification.h>