And an updated version of the patch, using ROUTE6 instead of ROUTE-IPv6 as an error message tag for uniformity.
Regards, Apollon
Index: openvpn-2.2.1/route.c =================================================================== --- openvpn-2.2.1.orig/route.c 2012-11-06 23:47:54.000000000 +0200 +++ openvpn-2.2.1/route.c 2012-11-07 00:05:52.000000000 +0200 @@ -88,6 +88,15 @@ return ret; } +struct route_ipv6_option_list * +clone_route_ipv6_option_list (const struct route_ipv6_option_list *src, struct gc_arena *a) +{ + const size_t rl6_size = array_mult_safe (sizeof(struct route_ipv6_option), src->capacity, sizeof(struct route_ipv6_option_list)); + struct route_ipv6_option_list *ret = gc_malloc (rl6_size, false, a); + memcpy (ret, src, rl6_size); + return ret; +} + void copy_route_option_list (struct route_option_list *dest, const struct route_option_list *src) { @@ -97,6 +106,15 @@ memcpy (dest, src, src_size); } +void +copy_route_ipv6_option_list (struct route_ipv6_option_list *dest, const struct route_ipv6_option_list *src) +{ + const size_t src_size = array_mult_safe (sizeof(struct route_ipv6_option), src->capacity, sizeof(struct route_ipv6_option_list)); + if (src->n > dest->capacity) + msg (M_FATAL, PACKAGE_NAME " ROUTE6: (copy) number of route options in src (%d) is greater than route list capacity in dest (%d)", src->n, dest->capacity); + memcpy (dest, src, src_size); +} + struct route_list * new_route_list (const int max_routes, struct gc_arena *a) { Index: openvpn-2.2.1/options.c =================================================================== --- openvpn-2.2.1.orig/options.c 2012-11-06 23:47:54.000000000 +0200 +++ openvpn-2.2.1/options.c 2012-11-06 23:47:54.000000000 +0200 @@ -2548,6 +2548,11 @@ o->pre_pull->routes = clone_route_option_list(o->routes, &o->gc); o->pre_pull->routes_defined = true; } + if (o->routes_ipv6) + { + o->pre_pull->routes_ipv6 = clone_route_ipv6_option_list(o->routes_ipv6, &o->gc); + o->pre_pull->routes_ipv6_defined = true; + } } } @@ -2569,6 +2574,14 @@ else o->routes = NULL; + if (pp->routes_ipv6_defined) + { + rol6_check_alloc (o); + copy_route_ipv6_option_list (o->routes_ipv6, pp->routes_ipv6); + } + else + o->routes_ipv6 = NULL; + o->foreign_option_index = pp->foreign_option_index; } Index: openvpn-2.2.1/options.h =================================================================== --- openvpn-2.2.1.orig/options.h 2012-11-06 23:47:54.000000000 +0200 +++ openvpn-2.2.1/options.h 2012-11-06 23:47:54.000000000 +0200 @@ -67,6 +67,9 @@ bool routes_defined; struct route_option_list *routes; + bool routes_ipv6_defined; + struct route_ipv6_option_list *routes_ipv6; + int foreign_option_index; }; Index: openvpn-2.2.1/route.h =================================================================== --- openvpn-2.2.1.orig/route.h 2012-11-06 23:47:54.000000000 +0200 +++ openvpn-2.2.1/route.h 2012-11-06 23:47:54.000000000 +0200 @@ -169,7 +169,9 @@ struct route_option_list *new_route_option_list (const int max_routes, struct gc_arena *a); struct route_ipv6_option_list *new_route_ipv6_option_list (const int max_routes, struct gc_arena *a); struct route_option_list *clone_route_option_list (const struct route_option_list *src, struct gc_arena *a); +struct route_ipv6_option_list *clone_route_ipv6_option_list (const struct route_ipv6_option_list *src, struct gc_arena *a); void copy_route_option_list (struct route_option_list *dest, const struct route_option_list *src); +void copy_route_ipv6_option_list (struct route_ipv6_option_list *dest, const struct route_ipv6_option_list *src); struct route_list *new_route_list (const int max_routes, struct gc_arena *a); struct route_ipv6_list *new_route_ipv6_list (const int max_routes, struct gc_arena *a);