Skip to contentSkip to conversation

multipath iroute

Openvpn-devel Dominique Rousseau 2 participants 2 messages Feb 4, 2010 – Feb 5, 2010

lore
Share & tools
lore
#0 lore raw

Hi

I wanted to make redundant VPNs by using multiple instances from same client to same server but current (2.1.1) implementation of OpenVPN override previous iroute definition when new client connects with same ip or same route.

Attached is a proposed patch to allow for multiple paths for the same route.

The functional target of the patch is that I modified the multi_route struct to have a property called instances instead of instance, which hosts an array of multi_instance.

It's a bit rough, and I don't doubt it needs a bi refactoring, since it's the first time I browse through openvpn's source code, but it seems to be functional and hasn't caused segfault since I try it.

Signature · 4 lines
Dominique Rousseau 
Neuronnexion, Prestataire Internet & Intranet
50, rue Riolan 80000 Amiens
tel: 03 22 71 61 90 - fax: 03 22 71 61 99 - http://www.neuronnexion.coop
multi.h +17 -8
@@ -137,7 +137,7 @@
 struct multi_route
 {
   struct mroute_addr addr;
-  struct multi_instance *instance;
+  struct multi_instance **instances;
 
 # define MULTI_ROUTE_CACHE   (1<<0)
 # define MULTI_ROUTE_AGEABLE (1<<1)
@@ -145,6 +145,7 @@
 
   unsigned int cache_generation;
   time_t last_reference;
+  unsigned int nb_use;
 };
 
 /*
@@ -279,6 +280,9 @@
     }
 }
 
+/* 
+moved to multi.c
+
 static inline void
 multi_route_del (struct multi_route *route)
 {
@@ -287,21 +291,26 @@
   multi_instance_dec_refcount (mi);
   free (route);
 }
+*/
 
 static inline bool
 multi_route_defined (const struct multi_context *m,
 		     const struct multi_route *r)
 {
-  if (r->instance->halt)
-    return false;
-  else if ((r->flags & MULTI_ROUTE_CACHE)
+  bool ret;
+  int i;
+  ret = false;
+  for (i = 0; i < r->nb_use; i++) {
+    if (!r->instances[i]->halt)
+      ret = ret | true;
+  }
+  if ((r->flags & MULTI_ROUTE_CACHE)
 	   && r->cache_generation != m->route_helper->cache_generation)
-    return false;
+    ret = false;
   else if ((r->flags & MULTI_ROUTE_AGEABLE)
 	   && r->last_reference + m->route_helper->ageable_ttl_secs < now)
-    return false;
-  else
-    return true;
+    ret = false;
+  return ret;
 }
 
 /*
multi.c +157 -41

298 lines not on this page · raw message

#1 lore raw

Hi,

I would be very interested in such a functionality too. I ran into this same problem a few months ago trying to get redundant VPNs as well.

(Just showing support, didn't look at the patch yet.)

--
Jannes

Quoted 38 lines · Dominique Rousseau

Hi

I wanted to make redundant VPNs by using multiple instances from same client to same server but current (2.1.1) implementation of OpenVPN override previous iroute definition when new client connects with same ip or same route.

Attached is a proposed patch to allow for multiple paths for the same route.

The functional target of the patch is that I modified the multi_route struct to have a property called instances instead of instance, which hosts an array of multi_instance.

It's a bit rough, and I don't doubt it needs a bi refactoring, since it's the first time I browse through openvpn's source code, but it seems to be functional and hasn't caused segfault since I try it.

--
Dominique Rousseau
Neuronnexion, Prestataire Internet & Intranet
50, rue Riolan 80000 Amiens
tel: 03 22 71 61 90 - fax: 03 22 71 61 99 - http://www.neuronnexion.coop

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel