fixed traffic selector redundancy removal code (not completely tested)
authorMartin Willi <martin@strongswan.org>
Tue, 6 Mar 2007 20:55:19 +0000 (20:55 -0000)
committerMartin Willi <martin@strongswan.org>
Tue, 6 Mar 2007 20:55:19 +0000 (20:55 -0000)
src/charon/config/policies/policy.c
src/charon/config/traffic_selector.c

index b853a5a..363d160 100644 (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;
 }
 
index cee45c2..2fb012e 100644 (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>