Skip to contentSkip to conversation

openvpn-testing tree available

Openvpn-devel In review David Sommerseth 7 participants 24 messages Feb 16, 2010 – Feb 22, 2010

lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Greetings all!

I am now announcing the openvpn-testing.git tree as open. Gert has already been announcing the availability as a response to some merge conflicts. Anyhow, those issues are solved.

The tree is also tagged with all 2.1 releases and RC releases. I have not bothered with tagging the 2.1 beta or any 2.0 releases at all. If somebody finds it useful and wants it, please generate a list of tag names and commit ID's and I'll update the tree.

What's next:

- - JuanJo Ciarliante's IPv6 patches for the transport layer. There are some merge conflicts here as well, which we need to solve. It's most probably due to different merge roots between our copies of the SVN tree. I hope JJO and I can solve this soon, then it will go into the allmerged branch immediately.

- - Go through the mailing list to pick up branches which has not been included into the the OpenVPN SVN tree. I will probably not go much further than the last 9-12 months. If you have a patch you want to be sure gets into the tree, please raise the attention by sending an e-mail to this mailing list. I don't intend to deliberately ignore patches.

James: Do you have an overview over patches you have included already? And patches you've received which has not been processed yet?

- - The eurephia patch got a review, with one comment I'd like to investigate a little bit more (If ctx->current_cert->sha1_hash is always valid). When this is done, the feat_eurephia branch will be merged into the allmerged branch.

- - Update the developers documentation on the wiki, with some "requirements" to get patches included. For already submitted patches I will be a little bit nicer. Patches after this mail should strive to follow the guidelines found in the mail discussion here [1]. All patches are *expected* to apply cleanly against the latest SVN BETA21/openvpn branch or the git master branch.

The next big test for this is when James does some more commits, and to see how smoothly it will merge in those changes.

For those wanting to contact me, I'm available on e-mail:
<[email protected]...> or on IRC (freenode, #openvpn-devel)

The git tree is available here:
<git://openvpn.git.sourceforge.net/gitroot/openvpn/openvpn-testing.git>

Web view of the git tree can be found here:
<http://openvpn.git.sourceforge.net/git/gitweb.cgi?p=openvpn/openvpn-testing.git>

kind regards,

David Sommerseth

[1]
<http://sourceforge.net/mailarchive/message.php?msg_name=4B6A9823.8010800%40topphemmelig.net>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkt66NMACgkQDC186MBRfrp4KACfQpqkUvcbB2GLxiBUx/ETX1Xw 0ZwAoIbajA0Q5/Rm7cP+AUGgNPezlEwg
=MvpN
-----END PGP SIGNATURE-----

#1 lore raw

PATCH 1/1 FQDN for routes should expand to all IPs

[ I've sent this in the past already, but just trying to make sure it
doesn't get lost somewhere. ]

When specifiying an FQDN for the network part of a route, OpenVPN should setup a route for each IP associated with that FQDN. Currently, it just chooses one of the IPs at random instead, which leads to inconsistent and unpredictable behavior since subsequent connections to that FQDN will sometimes go through the VPN and sometimes not.

The patch below works for me, and I'd welcome any help in bringing it to a state where it can be included in the mainline code. It was made against the openvpn-testing/master code.

Stefan

route.c +85 -54
index 24d4bd8..396a20b 100644
@@ -217,16 +217,19 @@ is_special_addr (const char *addr_str)
     return false;
 }
 
-static bool
+struct route *
 init_route (struct route *r,
+	    struct route *last_route,
 	    const struct route_option *ro,
 	    const struct route_special_addr *spec)
 {
   const in_addr_t default_netmask = ~0;
   bool status;
-
-  r->option = ro;
-  r->defined = false;
+  int nb = -1;
+  in_addr_t nets[MAX_IPS_PER_HOSTNAME];
+  in_addr_t netmask, gateway;
+  bool metric_defined;
+  int metric;
 
   /* network */
 
@@ -234,17 +237,19 @@ init_route (struct route *r,
     {
       goto fail;
     }
-  
-  if (!get_special_addr (spec, ro->network, &r->network, &status))
+
+  if (get_special_addr (spec, ro->network, &nets[0], &status))
+    nb = 1;
+  else
     {
-      r->network = getaddr (
-			    GETADDR_RESOLVE
-			    | GETADDR_HOST_ORDER
-			    | GETADDR_WARN_ON_SIGNAL,
-			    ro->network,
-			    0,
-			    &status,
-			    NULL);
+      nb = getaddr_all (GETADDR_RESOLVE
+			| GETADDR_HOST_ORDER
+			| GETADDR_WARN_ON_SIGNAL,
+			nets, MAX_IPS_PER_HOSTNAME,
+			ro->network,
+			0,
+			NULL);
+      status = (nb >= 0);
     }
 
   if (!status)
@@ -254,33 +259,33 @@ init_route (struct route *r,
 
   if (is_route_parm_defined (ro->netmask))
     {
-      r->netmask = getaddr (
-			    GETADDR_HOST_ORDER
-			    | GETADDR_WARN_ON_SIGNAL,
-			    ro->netmask,
-			    0,
-			    &status,
-			    NULL);
+      netmask = getaddr (
+			 GETADDR_HOST_ORDER
+			 | GETADDR_WARN_ON_SIGNAL,
+			 ro->netmask,
+			 0,
+			 &status,
+			 NULL);
       if (!status)
 	goto fail;
     }
   else
-    r->netmask = default_netmask;
+    netmask = default_netmask;
 
   /* gateway */
-
+      
   if (is_route_parm_defined (ro->gateway))
     {
-      if (!get_special_addr (spec, ro->gateway, &r->gateway, &status))
+      if (!get_special_addr (spec, ro->gateway, &gateway, &status))
 	{
-	  r->gateway = getaddr (
-				GETADDR_RESOLVE
-				| GETADDR_HOST_ORDER
-				| GETADDR_WARN_ON_SIGNAL,
-				ro->gateway,
-				0,
-				&status,
-				NULL);
+	  gateway = getaddr (
+			     GETADDR_RESOLVE
+			     | GETADDR_HOST_ORDER
+			     | GETADDR_WARN_ON_SIGNAL,
+			     ro->gateway,
+			     0,
+			     &status,
+			     NULL);
 	}
       if (!status)
 	goto fail;
@@ -288,7 +293,7 @@ init_route (struct route *r,
   else
     {
       if (spec->remote_endpoint_defined)
-	r->gateway = spec->remote_endpoint;
+	gateway = spec->remote_endpoint;
       else
 	{
 	  msg (M_WARN, PACKAGE_NAME " ROUTE: " PACKAGE_NAME " needs a gateway parameter for a --route option and no default was specified by either --route-gateway or --ifconfig options");
@@ -298,35 +303,54 @@ init_route (struct route *r,
 
   /* metric */
 
-  r->metric_defined = false;
-  r->metric = 0;
+  metric_defined = false;
+  metric = 0;
   if (is_route_parm_defined (ro->metric))
     {
-      r->metric = atoi (ro->metric);
-      if (r->metric < 0)
+      metric = atoi (ro->metric);
+      if (metric < 0)
 	{
 	  msg (M_WARN, PACKAGE_NAME " ROUTE: route metric for network %s (%s) must be >= 0",
 	       ro->network,
 	       ro->metric);
 	  goto fail;
 	}
-      r->metric_defined = true;
+      metric_defined = true;
     }
   else if (spec->default_metric_defined)
     {
-      r->metric = spec->default_metric;
-      r->metric_defined = true;
+      metric = spec->default_metric;
+      metric_defined = true;
     }
 
-  r->defined = true;
+  /* Now fill the corresponding route entries.  */
 
-  return true;
+  if (netmask != default_netmask && nb > 1)
+    /* If we add individual hosts, then every IP of that host is added,
+       but if we add a whole subnet, then only consider the first IP,
+       presuming that all the IPs are in the same subnet.  */
+    nb = 1;
+
+  /* Add a route for each one of the IPs found.  */
+  while (nb > 0 && r < last_route)
+    {
+      nb--;
+      r->option = ro;
+      r->network = nets[nb];
+      r->netmask = netmask;
+      r->gateway = gateway;
+      r->metric_defined = metric_defined;
+      r->metric = metric;
+      r->defined = true;
+      r++;
+    }
+
+  return r;
 
  fail:
   msg (M_WARN, PACKAGE_NAME " ROUTE: failed to parse/resolve route for host/network: %s",
        ro->network);
-  r->defined = false;
-  return false;
+  return NULL;
 }
 
 void
@@ -438,22 +462,29 @@ init_route_list (struct route_list *rl,
   else
     rl->spec.remote_endpoint_defined = false;
 
-  if (!(opt->n >= 0 && opt->n <= rl->capacity))
-    msg (M_FATAL, PACKAGE_NAME " ROUTE: (init) number of route options (%d) is greater than route list capacity (%d)", opt->n, rl->capacity);
-
   /* parse the routes from opt to rl */
   {
-    int i, j = 0;
+    int i;
+    struct route *cur_route = rl->routes;
+    struct route *last_route = &rl->routes[rl->capacity];
     for (i = 0; i < opt->n; ++i)
       {
-	if (!init_route (&rl->routes[j],
-			 &opt->routes[i],
-			 &rl->spec))
-	  ret = false;
+	if (cur_route >= last_route)
+	  msg (M_FATAL, PACKAGE_NAME " ROUTE: (init) number of route options (%d) is greater than route list capacity (%d)", opt->n, rl->capacity);
 	else
-	  ++j;
+	  {
+	    struct route *next_route
+	      = init_route (cur_route,
+			    last_route,
+			    &opt->routes[i],
+			    &rl->spec);
+	    if (!next_route)
+	      ret = false;
+	    else
+	      cur_route = next_route;
+	  }
       }
-    rl->n = j;
+    rl->n = cur_route - rl->routes;
   }
 
   gc_free (&gc);
socket.c +58 -39

146 lines not on this page · raw message

socket.h +7 -0
index 6877e66..8f84537 100644
@@ -450,6 +450,13 @@ bool unix_socket_get_peer_uid_gid (const socket_descriptor_t sd, int *uid, int *
 #define GETADDR_UPDATE_MANAGEMENT_STATE (1<<8)
 #define GETADDR_RANDOMIZE             (1<<9)
 
+#define MAX_IPS_PER_HOSTNAME 100
+
+int getaddr_all (unsigned int flags,
+		 in_addr_t *ret, int size,
+		 const char *hostname,
+		 int resolve_retry_seconds,
+		 volatile int *signal_received);
 in_addr_t getaddr (unsigned int flags,
 		   const char *hostname,
 		   int resolve_retry_seconds,
#2 lore raw

Re: [Openvpn-devel] [PATCH] FQDN for routes should expand to all IPs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 9 lines · Stefan Monnier

[ I've sent this in the past already, but just trying to make sure it
doesn't get lost somewhere. ]

When specifiying an FQDN for the network part of a route, OpenVPN should setup a route for each IP associated with that FQDN. Currently, it just chooses one of the IPs at random instead, which leads to inconsistent and unpredictable behavior since subsequent connections to that FQDN will sometimes go through the VPN and sometimes not.

Quoted 4 lines

The patch below works for me, and I'd welcome any help in bringing it to a state where it can be included in the mainline code. It was made against the openvpn-testing/master code.

Thanks a lot for you patch! In general, it very looks good. Can you elaborate a little bit on how you have tested this patch? Have you checked it for memory leaks? (e.g. using valgrind) What happens if no FQDNs are found?

With some good answers and if this gets acceptance from more people in regards to usability, I'm giving it an ACK.

kind regards,

David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkt78XoACgkQDC186MBRfroAnQCeJpU1wsEvAF5EvoFGhmlpU6DC 7VIAmgNo0hHLgcr4T+Y6x4HR9COGLQMV
=bAG6
-----END PGP SIGNATURE-----

#17 lore raw
In reply to David Sommerseth

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 3 lines · David Sommerseth

Greetings all!

[...snip...]

Quoted 3 lines

What's next:

[...snip...]

Quoted 8 lines

- Update the developers documentation on the wiki, with some "requirements" to get patches included. For already submitted patches I will be a little bit nicer. Patches after this mail should strive to follow the guidelines found in the mail discussion here [1]. All patches are *expected* to apply cleanly against the latest SVN BETA21/openvpn branch or the git master branch.

Samuli beat me in doing this. I've reviewed it, and it looks very good!
Thanks, Samuli!

The developer docs are available here:
<http://www.secure-computing.net/wiki/index.php/OpenVPN/Developer_documentation>

These guidelines are not carved into stone, but we want to try to follow them as closely as possible. If you disagree with them, or have ideas for improvements, lets discuss that here on the mailing list or on the IRC meetings.

Once again, thank you Samuli for your work!

kind regards,

David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkt8IGAACgkQDC186MBRfrpnoQCeLBk2MrKYRirS2StIiJ0WvCyk 6OwAn0dEW7ksKOuvBz3YxlLQLAskYtyg
=6faU
-----END PGP SIGNATURE-----

#18 lore raw
In reply to David Sommerseth

Hi David,

Quoted 9 lines · David Sommerseth

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Greetings all!

I am now announcing the openvpn-testing.git tree as open.  Gert has already been announcing the availability as a response to some merge conflicts.  Anyhow, those issues are solved.

\o/ !

Quoted 7 lines

The tree is also tagged with all 2.1 releases and RC releases.  I have not bothered with tagging the 2.1 beta or any 2.0 releases at all.  If somebody finds it useful and wants it, please generate a list of tag names and commit ID's and I'll update the tree.

Quoted 7 lines

What's next:

- - JuanJo Ciarliante's IPv6 patches for the transport layer. There are some merge conflicts here as well, which we need to solve. It's most probably due to different merge roots between our copies of the SVN tree.  I hope JJO and I can solve this soon, then it will go into the allmerged branch immediately.

Cool, thanks a lot for the heads-up.

I'll try to solve this before by next week, it's sooo great to see all the community contributed bits
being taken good care :)))

Quoted 33 lines

- - Go through the mailing list to pick up branches which has not been included into the the OpenVPN SVN tree.  I will probably not go much further than the last 9-12 months.  If you have a patch you want to be sure gets into the tree, please raise the attention by sending an e-mail to this mailing list.  I don't intend to deliberately ignore patches.

 James: Do you have an overview over patches you have included already? And patches you've received which has not been processed yet?

- - The eurephia patch got a review, with one comment I'd like to investigate a little bit more (If ctx->current_cert->sha1_hash is always valid).  When this is done, the feat_eurephia branch will be merged into the allmerged branch.

- - Update the developers documentation on the wiki, with some "requirements" to get patches included.  For already submitted patches I will be a little bit nicer.  Patches after this mail should strive to follow the guidelines found in the mail discussion here [1].  All patches are *expected* to apply cleanly against the latest SVN BETA21/openvpn branch or the git master branch.

The next big test for this is when James does some more commits, and to see how smoothly it will merge in those changes.

For those wanting to contact me, I'm available on e-mail:
<[email protected]...> or on IRC (freenode, #openvpn-devel)

The git tree is available here:
<git://openvpn.git.sourceforge.net/gitroot/openvpn/openvpn-testing.git>

Quoted 6 lines

Web view of the git tree can be found here:
<http://openvpn.git.sourceforge.net/git/gitweb.cgi?p=openvpn/openvpn-testing.git>

kind regards,

Cheers,

Quoted 16 lines

David Sommerseth

[1]
<http://sourceforge.net/mailarchive/message.php?msg_name=4B6A9823.8010800%40topphemmelig.net>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkt66NMACgkQDC186MBRfrp4KACfQpqkUvcbB2GLxiBUx/ETX1Xw 0ZwAoIbajA0Q5/Rm7cP+AUGgNPezlEwg
=MvpN
-----END PGP SIGNATURE-----

Signature · 1 line
--JuanJo ; echo [email protected]... | sed 's/[SPAM]//g'
#3 lore raw

Re: [Openvpn-devel] [PATCH] FQDN for routes should expand to all IPs

In reply to David Sommerseth
Quoted 2 lines

Thanks a lot for you patch! In general, it very looks good. Can you elaborate a little bit on how you have tested this patch?

I've been using it on my client machines for the last few months. This is not a very extensive test, obviously: they're all configured identically and so they all lookup the same FQDNs received from the same VPN server.

Quoted 1 line

Have you checked it for memory leaks? (e.g. using valgrind)

No, my patch does not use dynamic memory allocation, so memory leaks seem unlikely (tho I don't know enough of the functions I call to be 100% sure).

Quoted 1 line

What happens if no FQDNs are found?

I have not touched this part of the code, AFAIK, so the behavior should be the same as before (not sure what it is).

Stefan

#4 lore raw

Re: [Openvpn-devel] [PATCH] FQDN for routes should expand to all IPs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 10 lines · Stefan Monnier
Quoted 2 lines

Thanks a lot for you patch! In general, it very looks good. Can you elaborate a little bit on how you have tested this patch?

I've been using it on my client machines for the last few months. This is not a very extensive test, obviously: they're all configured identically and so they all lookup the same FQDNs received from the same VPN server.

Quoted 1 line

Have you checked it for memory leaks? (e.g. using valgrind)

Quoted 8 lines

No, my patch does not use dynamic memory allocation, so memory leaks seem unlikely (tho I don't know enough of the functions I call to be 100% sure).

Quoted 1 line

What happens if no FQDNs are found?

I have not touched this part of the code, AFAIK, so the behavior should be the same as before (not sure what it is).

Hi Stefan,

I've gone through parts of your code more carefully again, looking *how* you solve things, not just if it is following coding standards, how it merges, and the obvious pitfalls which can cause troubles. And I chose to do this after you in another mail thread said "[I'm] Not a network programmer by a long shot, just a user who needed a specific feature". This statement raised my attention and made me a bit more concerned ;-)

* Memory allocation

You are right in regards to dynamic memory allocation. You're using static array allocation, defined by MAX_IPS_PER_HOSTNAME. This value is set to 100. Where did you take this number from? IMHO, that sounds to be fairly high.

The average user might have hits between 1 and 5 IP addresses (guestimate) on such a hostname lookups. There are a few things I am concerned about in this regards. Even though on my platform in_addr_t only needs 4 bytes, other platforms might use more. If that platform is an embedded device with even limited available memory, 400 bytes can be much. This can especially be hurtful in such environments if more connections hit this function in about the same time. For example, if 10 connections/clients does this call in parallel, it will suddenly require 4000 bytes.

Remember that the memory which is allocated "static" in functions like you have done, are in the reality allocated dynamically when the function is called. The advantage is this approach, is that it is easier for developers to write the code. The developer don't need to care about explicit malloc() or calloc() calls, neither to free the memory afterwards. The compiler does this job for you. (Global variables on the other hand, are different in this regards, but that's another chapter.)

On the other hand, it might be that the scheduler (event handler) in OpenVPN won't trigger multiple calls to getaddr(), but that's in its current state. This can change, and then this function should be safe in that regards as well. TBH, I believe this serialised behaviour of the scheduler in OpenVPN needs to change in the future, to improve the performance.

I have two suggestions how to work around this:

1) Make use of dynamic memory allocation
You return number of IPs retrieved, so you know how much data to free later on. You might also want to have a configuration parameter which can limit the amount IPs allowed to be processed. This also gives users with restricted memory usage better control.

2) Reduce MAX_IPS_PER_HOSTNAME and make this a default value. Then make this number changeable via a configuration option (in options.c). For me a reasonable default number would be 5 or 10 in this situation.

* usage of get_random in getaddr() [socket.c:261]

I admit I should have spotted this one on the first review. Because this code snippet below looks really odd to me.

if (nb > 1)

    {
      msg (D_RESOLVE_ERRORS, "RESOLVE: NOTE: %s resolves to %d
			      addresses, choosing one at random",
	   hostname,
	   nb);
      return ips[get_random () % nb];
    }

Why on earth do you want to use get_random() in this situation? Why not always return ips[0]? Fair enough, the warning may stay, just adjusting it saying it will return the first IP address it resolved. Maybe it should be a possibility to mute this warning as well, somehow, as this might not need to be an error, and with a lot of traffic this warning could be rather annoying log trash.

Another trap here is that you in init_route() [route.c:282] use both getaddr_all() and getaddr(). How do you make sure that you don't set the wrong netmask against the different IP addresses returned by getaddr_all()? I might have misunderstood the code here, but please explain what is happening here.

* Copyright notes

According to the GPL license, you are allowed to add your a copyright statement at the top of the file in addition to the the OpenVPN Technologies, Inc copyright note. If you also add a simple sentence describing the change, that would also be good.

At least these two first things needs to be fixed, IMHO, before we can include it into a testing tree. I'm sorry for now withdrawing my initial and quite positive attitude for an ACK. But we need to have a few more rounds on this code, I see now.

kind regards,

David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkt9KlwACgkQDC186MBRfrpzXACfTf2A7yF2O0K0Ek8+/VnFLJWq ZW4AoIDMuIuqGF+wRzBMP+xVC8KevYe5
=8z/v
-----END PGP SIGNATURE-----

#5 lore raw

Re: [Openvpn-devel] [PATCH] FQDN for routes should expand to all IPs

Hi,

Quoted 4 lines · David Sommerseth

The average user might have hits between 1 and 5 IP addresses (guestimate) on such a hostname lookups. There are a few things I am concerned about in this regards. Even though on my platform in_addr_t only needs 4 bytes, other platforms might use more. If that platform is

in_addr_t is an IPv4 address, so I would be very surprised to see it require more than 4 bytes on any reasonable system.

[..]

Quoted 8 lines

Remember that the memory which is allocated "static" in functions like you have done, are in the reality allocated dynamically when the function is called. The advantage is this approach, is that it is easier for developers to write the code. The developer don't need to care about explicit malloc() or calloc() calls, neither to free the memory afterwards. The compiler does this job for you. (Global variables on the other hand, are different in this regards, but that's another chapter.)

Just to nitpick on that: those variables are not malloc()'ed, they are put on the stack. Different area of the memory management -- but still valuable on embedded systems, of course.

Since the openvpn server process is not multithreaded, there is no risk of it happening "10 times in parallel", though. So we lose 400 bytes of stack space while getaddr() is called.

[..]

Quoted 5 lines

1) Make use of dynamic memory allocation
You return number of IPs retrieved, so you know how much data to free later on. You might also want to have a configuration parameter which can limit the amount IPs allowed to be processed. This also gives users with restricted memory usage better control.

I see this specific case as "somewhat borderline" - adding dynamic memory handling will save 400 bytes of stack space (good) but will bring in extra code for sizing, allocating, and free()ing the memory, which might well end up being in the same order of bytes of code space - and
that's memory "lost forever". And the risk of programmer error is higher...

Quoted 3 lines

2) Reduce MAX_IPS_PER_HOSTNAME and make this a default value. Then make this number changeable via a configuration option (in options.c). For me a reasonable default number would be 5 or 10 in this situation.

Getting configuration options propagated down all the way into a generic function like getaddr() is either painful (lots of callers that might themselves not have a pointer to the config struct around yet) or messy (global variables).

Reading through this, my suggestion would be "go for a reasonable but lower value", something like "20". Still arbitrary, but brings down the (transient!) memory used to 80 bytes, which is hard to beat with any sort of dynamic allocation scheme.

Quoted 15 lines

* usage of get_random in getaddr() [socket.c:261]

I admit I should have spotted this one on the first review. Because this code snippet below looks really odd to me.

if (nb > 1)

    {
      msg (D_RESOLVE_ERRORS, "RESOLVE: NOTE: %s resolves to %d
			      addresses, choosing one at random",
	   hostname,
	   nb);
      return ips[get_random () % nb];
    }
Quoted 1 line

Why on earth do you want to use get_random() in this situation?

That's original OpenVPN code, just moved to a different place.

While I am not saying that it should be that way, or should not be that way, it's not something brought in by the patch in question, so should not be covered by its review.

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#6 lore raw

Re: [Openvpn-devel] [PATCH] FQDN for routes should expand to all IPs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 10 lines · Gert Doering

Hi,

Quoted 4 lines · David Sommerseth

The average user might have hits between 1 and 5 IP addresses (guestimate) on such a hostname lookups. There are a few things I am concerned about in this regards. Even though on my platform in_addr_t only needs 4 bytes, other platforms might use more. If that platform is

in_addr_t is an IPv4 address, so I would be very surprised to see it require more than 4 bytes on any reasonable system.

True, I didn't think about that. I actually thought of in_addr_t as a struct, for some strange reason. But you're right.

Quoted 10 lines

[..]

Quoted 8 lines

Remember that the memory which is allocated "static" in functions like you have done, are in the reality allocated dynamically when the function is called. The advantage is this approach, is that it is easier for developers to write the code. The developer don't need to care about explicit malloc() or calloc() calls, neither to free the memory afterwards. The compiler does this job for you. (Global variables on the other hand, are different in this regards, but that's another chapter.)

Quoted 3 lines

Just to nitpick on that: those variables are not malloc()'ed, they are put on the stack. Different area of the memory management -- but still valuable on embedded systems, of course.

Correct! Thanks for the nitpick! Stack memory is anyway precious, on some systems more than others depending on how stack allocation is done.

Quoted 3 lines

Since the openvpn server process is not multithreaded, there is no risk of it happening "10 times in parallel", though. So we lose 400 bytes of stack space while getaddr() is called.

As I said initially, in the current situation this might not be the case. But this part of OpenVPN will most likely see a change in the future. Not forked nor threaded applications scales very badly on today's multi core systems. So this comment was really meant as a hands-up of a potential issue in the future.

Quoted 7 lines

[..]

Quoted 5 lines

1) Make use of dynamic memory allocation
You return number of IPs retrieved, so you know how much data to free later on. You might also want to have a configuration parameter which can limit the amount IPs allowed to be processed. This also gives users with restricted memory usage better control.

Quoted 5 lines

I see this specific case as "somewhat borderline" - adding dynamic memory handling will save 400 bytes of stack space (good) but will bring in extra code for sizing, allocating, and free()ing the memory, which might well end up being in the same order of bytes of code space - and
that's memory "lost forever". And the risk of programmer error is higher...

Good point!

Quoted 8 lines
Quoted 3 lines

2) Reduce MAX_IPS_PER_HOSTNAME and make this a default value. Then make this number changeable via a configuration option (in options.c). For me a reasonable default number would be 5 or 10 in this situation.

Getting configuration options propagated down all the way into a generic function like getaddr() is either painful (lots of callers that might themselves not have a pointer to the config struct around yet) or messy (global variables).

Reasonable argument. On the other hand, a hackerish approach it might be considered to use a global variable in this case. This setting should only be read only, not changed and is a global setting. Even though, I'm not a big fan of global variables, I'm willing to consider it in this setting.

Quoted 4 lines

Reading through this, my suggestion would be "go for a reasonable but lower value", something like "20". Still arbitrary, but brings down the (transient!) memory used to 80 bytes, which is hard to beat with any sort of dynamic allocation scheme.

Good point! But that's only valid as long as openvpn stays single threaded. On the other hand, this might be good enough for now.

Quoted 15 lines
Quoted 15 lines

* usage of get_random in getaddr() [socket.c:261]

I admit I should have spotted this one on the first review. Because this code snippet below looks really odd to me.

if (nb > 1)

    {
      msg (D_RESOLVE_ERRORS, "RESOLVE: NOTE: %s resolves to %d
			      addresses, choosing one at random",
	   hostname,
	   nb);
      return ips[get_random () % nb];
    }
Quoted 3 lines
Quoted 1 line

Why on earth do you want to use get_random() in this situation?

That's original OpenVPN code, just moved to a different place.

Good catch, I honestly didn't see that move. Sorry for the blame here, Stefan!

Quoted 3 lines

While I am not saying that it should be that way, or should not be that way, it's not something brought in by the patch in question, so should not be covered by its review.

Agreed. Lets hear with James today if he see any reasons for using get_random() in this situation. It really do not see any advantage of this at all.

kind regards,

David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkt9Sr4ACgkQDC186MBRfrpVBwCdF31D+3Ta0ToKGIEuO06oFPqr AkQAn06srxO1dXE62MW/EqLR7QOLuTZA
=ic3i
-----END PGP SIGNATURE-----

#7 lore raw

Re: [Openvpn-devel] [PATCH] FQDN for routes should expand to all IPs

Quoted 24 lines · David Sommerseth
Quoted 3 lines · Gert Doering
Quoted 3 lines

* usage of get_random in getaddr() [socket.c:261]

I admit I should have spotted this one on the first review.

Because

Quoted 12 lines
Quoted 12 lines

this code snippet below looks really odd to me.

if (nb > 1)

    {
      msg (D_RESOLVE_ERRORS, "RESOLVE: NOTE: %s resolves to %d
			      addresses, choosing one at random",
	   hostname,
	   nb);
      return ips[get_random () % nb];
    }
Quoted 5 lines
Quoted 1 line

Why on earth do you want to use get_random() in this situation?

That's original OpenVPN code, just moved to a different place.

While I am not saying that it should be that way, or should not be

that

Quoted 8 lines
Quoted 1 line

way, it's not something brought in by the patch in question, so

should

Quoted 1 line

not be covered by its review.

Agreed. Lets hear with James today if he see any reasons for using get_random() in this situation. It really do not see any advantage of
this at all.

FWIW RFC 1034 (DOMAIN NAMES - CONCEPTS AND FACILITIES
http://www.rfc-editor.org/rfc/rfc1034.txt) seems to imply that this sort of munging is appropriate in a resolver. In any case the ordering of the results when multiple A records are returned seems to be entirely up to the DNS implementation. (I seem to recall that bind attempts to rotate the ordering of the names, but I can't find any reference to this at a glance and could be wrong.) The choice to randomize seems wrong because it will destroy anything "smart" that the resolver might do.

--------------<snip>------------------
5.2. Client-resolver interface

5.2.1. Typical functions

The client interface to the resolver is influenced by the local host's conventions, but the typical resolver-client interface has three functions:

1. Host name to host address translation.

This function is often defined to mimic a previous HOSTS.TXT based function. Given a character string, the caller wants one or more 32 bit IP addresses. Under the DNS, it translates into a request for type A RRs. Since the DNS does not preserve the order of RRs, this function may choose to sort the returned addresses or select the "best" address if the service returns only one choice to the client. Note that a multiple address return is recommended, but a single address may be the only way to emulate prior HOSTS.TXT services.

Karl <[email protected]...>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#8 lore raw

Re: [Openvpn-devel] [PATCH] FQDN for routes should expand to all IPs

Quoted 3 lines · Karl O. Pinc

(I seem to recall that bind attempts to rotate the ordering of the names, but I can't find any reference to this at a glance and could be wrong.)

Ah, here it is. Bind9 has a rrset-order directive. Results can be fixed, random, or cyclic but fixed is disabled and must be enabled by compilation directive.

So, unless you're pulling names out of /etc/hosts it's likely that randomization does nothing. And if the bind administrator has gone to the extra work to enable a fixed ordering of RR records then randomization destroys his work.

The only thing randomization would be good for is when pulling names out of a hosts file, and even then I'd want to leave the job to the resolver. If it's important to randomize hosts entries then IMO there should be something in the config file to enable randomization, and that is probably solving the wrong problem.

Regards,

Karl <[email protected]...>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#19 lore raw
In reply to JuanJo Ciarlante
Quoted 31 lines · JuanJo Ciarlante

Hi David,

Quoted 9 lines · David Sommerseth

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Greetings all!

I am now announcing the openvpn-testing.git tree as open.  Gert has already been announcing the availability as a response to some merge conflicts.  Anyhow, those issues are solved.

\o/ !

Quoted 7 lines

The tree is also tagged with all 2.1 releases and RC releases.  I have not bothered with tagging the 2.1 beta or any 2.0 releases at all.  If somebody finds it useful and wants it, please generate a list of tag names and commit ID's and I'll update the tree.

Quoted 7 lines

What's next:

- - JuanJo Ciarliante's IPv6 patches for the transport layer. There are some merge conflicts here as well, which we need to solve. It's most probably due to different merge roots between our copies of the SVN tree.  I hope JJO and I can solve this soon, then it will go into the allmerged branch immediately.

Quoted 3 lines

Cool, thanks a lot for the heads-up.

I'll try to solve this before by next week,

I've just did a cut+merge, fyi I had to use:
git-format-patch -k --stdout stock..master |git-am -3 -k
(stock: my svn-import'd tree, master: my local head)
, worked fine (b/c of the different svn-import history(?), git could not find a common ancestor, then the need to fallback to "diff | patch").
It also successful passes my tests as stated in README.ipv6.

I've pushed this to my github repo, so something in the lines of:
git-remote add -f -t openvpn-testing-master+jjo-ipv6 \
jjo-ipv6 git://github.com/jjo/openvpn-ipv6

+merge should be able to fast-forward your master head.

I still need to do some touches for allmerged, as we conflict w/ Gert's IPv6 patch on a mroute.c chunk IIRC.

Cheers,

Quoted 68 lines

it's
sooo great to see all the community contributed bits being taken good care   :)))

Quoted 33 lines

- - Go through the mailing list to pick up branches which has not been included into the the OpenVPN SVN tree.  I will probably not go much further than the last 9-12 months.  If you have a patch you want to be sure gets into the tree, please raise the attention by sending an e-mail to this mailing list.  I don't intend to deliberately ignore patches.

 James: Do you have an overview over patches you have included already? And patches you've received which has not been processed yet?

- - The eurephia patch got a review, with one comment I'd like to investigate a little bit more (If ctx->current_cert->sha1_hash is always valid).  When this is done, the feat_eurephia branch will be merged into the allmerged branch.

- - Update the developers documentation on the wiki, with some "requirements" to get patches included.  For already submitted patches I will be a little bit nicer.  Patches after this mail should strive to follow the guidelines found in the mail discussion here [1].  All patches are *expected* to apply cleanly against the latest SVN BETA21/openvpn branch or the git master branch.

The next big test for this is when James does some more commits, and to see how smoothly it will merge in those changes.

For those wanting to contact me, I'm available on e-mail:
<[email protected]...> or on IRC (freenode, #openvpn-devel)

The git tree is available here:
<git://openvpn.git.sourceforge.net/gitroot/openvpn/openvpn-testing.git>

Quoted 6 lines

Web view of the git tree can be found here:
<http://openvpn.git.sourceforge.net/git/gitweb.cgi?p=openvpn/openvpn-testing.git>

kind regards,

Cheers,

Quoted 7 lines

David Sommerseth

[1]
<http://sourceforge.net/mailarchive/message.php?msg_name=4B6A9823.8010800%40topphemmelig.net>

Quoted 9 lines

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkt66NMACgkQDC186MBRfrp4KACfQpqkUvcbB2GLxiBUx/ETX1Xw 0ZwAoIbajA0Q5/Rm7cP+AUGgNPezlEwg
=MvpN
-----END PGP SIGNATURE-----

--
--JuanJo ; echo [email protected]... | sed 's/[SPAM]//g'

Signature · 1 line
--JuanJo ; echo [email protected]... | sed 's/[SPAM]//g'
#11 lore raw

Re: [Openvpn-devel] [PATCH] FQDN for routes should expand to all IPs

In reply to David Sommerseth
Quoted 4 lines

You are right in regards to dynamic memory allocation. You're using static array allocation, defined by MAX_IPS_PER_HOSTNAME. This value is set to 100. Where did you take this number from? IMHO, that sounds to be fairly high.

Actually, I don't use static allocation but stack allocation. The value of 100 comes straight out of nowhere. Basically I though "hmm, I've never seen more than about 10 IPs for a given FQDN, so 100 should cover most cases". This is based on the premise that 400bytes of stack space is pretty much negligible on the one hand, and that more than 100 IPs is so unlikely that dynamic allocation is not worth the trouble.

Quoted 2 lines

Correct! Thanks for the nitpick! Stack memory is anyway precious, on some systems more than others depending on how stack allocation is done.

What's the smallest system on which OpenVPN is expected to work? My OpenVPN server has 32MB of RAM (a linksys home router), and I assumed it was on the lower scale already. A system where 1KB of stack space is significant would have to be a lot smaller.

Quoted 5 lines

As I said initially, in the current situation this might not be the case. But this part of OpenVPN will most likely see a change in the future. Not forked nor threaded applications scales very badly on today's multi core systems. So this comment was really meant as a hands-up of a potential issue in the future.

Depending on the style of threading, I could imagine 1KB of stack space per thread to become more significant, indeed. I'll let others decide whether it's likely to be a real problem or not.

Quoted 5 lines

Reasonable argument. On the other hand, a hackerish approach it might be considered to use a global variable in this case. This setting should only be read only, not changed and is a global setting. Even though, I'm not a big fan of global variables, I'm willing to consider it in this setting.

If it's a config var, it could indeed just be a global var, so I don't think it would be very complex. But that's really not something the user should have to configure.

Quoted 6 lines
Quoted 4 lines

Reading through this, my suggestion would be "go for a reasonable but lower value", something like "20". Still arbitrary, but brings down the (transient!) memory used to 80 bytes, which is hard to beat with any sort of dynamic allocation scheme.

Good point! But that's only valid as long as openvpn stays single threaded. On the other hand, this might be good enough for now.

A normal function's activation frame can already be within the same order of magnitude, so worrying about 80bytes sounds pretty extreme to me (as a compiler guy). OTOH I don't know if 20 entries is enough (it's plenty for my use case, tho, so I'd be fine with this choice).

Stefan

#12 lore raw

Re: [Openvpn-devel] [PATCH] FQDN for routes should expand to all IPs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 12 lines · Stefan Monnier
Quoted 4 lines

You are right in regards to dynamic memory allocation. You're using static array allocation, defined by MAX_IPS_PER_HOSTNAME. This value is set to 100. Where did you take this number from? IMHO, that sounds to be fairly high.

Actually, I don't use static allocation but stack allocation. The value of 100 comes straight out of nowhere. Basically I though "hmm, I've never seen more than about 10 IPs for a given FQDN, so 100 should cover most cases". This is based on the premise that 400bytes of stack space is pretty much negligible on the one hand, and that more than 100 IPs is so unlikely that dynamic allocation is not worth the trouble.

Quoted 7 lines
Quoted 2 lines

Correct! Thanks for the nitpick! Stack memory is anyway precious, on some systems more than others depending on how stack allocation is done.

What's the smallest system on which OpenVPN is expected to work? My OpenVPN server has 32MB of RAM (a linksys home router), and I assumed it was on the lower scale already. A system where 1KB of stack space is significant would have to be a lot smaller.

Unfortunately, it's running on a lot of different embedded systems. OpenWRT and dd-wrt are just two of many firmwares which ships it. I would not be surprised if somebody have made VoIP hardware phones which includes OpenVPN. And these phones could in theory even be in the 4-8MB segment.

OpenVPN Techonologies, Inc. might know more about commercial users need, as I presume most embedded people who goes commercial have an agreement with them. (but I might be wrong though).

Quoted 16 lines
Quoted 5 lines

As I said initially, in the current situation this might not be the case. But this part of OpenVPN will most likely see a change in the future. Not forked nor threaded applications scales very badly on today's multi core systems. So this comment was really meant as a hands-up of a potential issue in the future.

Depending on the style of threading, I could imagine 1KB of stack space per thread to become more significant, indeed. I'll let others decide whether it's likely to be a real problem or not.

Quoted 5 lines

Reasonable argument. On the other hand, a hackerish approach it might be considered to use a global variable in this case. This setting should only be read only, not changed and is a global setting. Even though, I'm not a big fan of global variables, I'm willing to consider it in this setting.

Quoted 3 lines

If it's a config var, it could indeed just be a global var, so I don't think it would be very complex. But that's really not something the user should have to configure.

That depends on the solution we end up with.

Quoted 11 lines
Quoted 6 lines
Quoted 4 lines

Reading through this, my suggestion would be "go for a reasonable but lower value", something like "20". Still arbitrary, but brings down the (transient!) memory used to 80 bytes, which is hard to beat with any sort of dynamic allocation scheme.

Good point! But that's only valid as long as openvpn stays single threaded. On the other hand, this might be good enough for now.

A normal function's activation frame can already be within the same order of magnitude, so worrying about 80bytes sounds pretty extreme to me (as a compiler guy). OTOH I don't know if 20 entries is enough (it's plenty for my use case, tho, so I'd be fine with this choice).

Then I would say we will push this down to 20 for now, and we will have a look at how this works out. This can be a decent solution also for embedded devices, as I presume most of them will be acting as clients and not servers - which means they will most likely not be affected immediately if (when) OpenVPN changes into a multi-threaded application.

kind regards,

David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkt+U68ACgkQDC186MBRfrpuWACfRTmcnRVqgbYGUYNUHgB5iQHO xZUAn2OJz5g0FeM7LuRzoiL178b0Mafq
=KeXT
-----END PGP SIGNATURE-----

#20 lore raw
In reply to JuanJo Ciarlante

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 21 lines · JuanJo Ciarlante
Quoted 4 lines · JuanJo Ciarlante
Quoted 4 lines

Hi David,

On Tue, Feb 16, 2010 at 7:49 PM, David Sommerseth
<[email protected]...> wrote:

Greetings all!

I am now announcing the openvpn-testing.git tree as open. Gert has already been announcing the availability as a response to some merge conflicts. Anyhow, those issues are solved.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

\o/ !

The tree is also tagged with all 2.1 releases and RC releases. I have not bothered with tagging the 2.1 beta or any 2.0 releases at all. If somebody finds it useful and wants it, please generate a list of tag names and commit ID's and I'll update the tree.

Quoted 31 lines

What's next:

- JuanJo Ciarliante's IPv6 patches for the transport layer. There are some merge conflicts here as well, which we need to solve. It's most probably due to different merge roots between our copies of the SVN tree. I hope JJO and I can solve this soon, then it will go into the allmerged branch immediately.

Quoted 23 lines
Quoted 4 lines
Quoted 4 lines

Cool, thanks a lot for the heads-up.

I'll try to solve this before by next week,

I've just did a cut+merge, fyi I had to use:
git-format-patch -k --stdout stock..master |git-am -3 -k
(stock: my svn-import'd tree, master: my local head)
, worked fine (b/c of the different svn-import history(?), git could not find a common ancestor, then the need to fallback to "diff | patch").
It also successful passes my tests as stated in README.ipv6.

I've pushed this to my github repo, so something in the lines of:
git-remote add -f -t openvpn-testing-master+jjo-ipv6 \
jjo-ipv6 git://github.com/jjo/openvpn-ipv6

+merge should be able to fast-forward your master head.

I still need to do some touches for allmerged, as we conflict w/ Gert's IPv6 patch on a mroute.c chunk IIRC.

Great! Thank you for your work here!

I've created an feat_ipv6_transport branch where I'll track your patches. Gert's IPv6 patches are in feat_ipv6_payload (which are also merged into the allmerged branch). I've started the discussion about the merge conflict in another mail thread.

It's all pushed out to the openvpn-testing.git, so please feel free to update me when you have solved these issues or have other updates!

kind regards,

David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkt+crAACgkQDC186MBRfroDNgCgsZwPBeAFzR44FB34Xv0HInAr 46EAoKZtDgoSvqQIzpQu5XNEygaA7ccs
=rqXo
-----END PGP SIGNATURE-----

#21 lore raw

Hey David,

Quoted 57 lines · David Sommerseth

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 21 lines · JuanJo Ciarlante
Quoted 4 lines · JuanJo Ciarlante
Quoted 4 lines

Hi David,

On Tue, Feb 16, 2010 at 7:49 PM, David Sommerseth
<[email protected]...> wrote:

Greetings all!

I am now announcing the openvpn-testing.git tree as open.  Gert has already been announcing the availability as a response to some merge conflicts.  Anyhow, those issues are solved.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

\o/ !

The tree is also tagged with all 2.1 releases and RC releases.  I have not bothered with tagging the 2.1 beta or any 2.0 releases at all.  If somebody finds it useful and wants it, please generate a list of tag names and commit ID's and I'll update the tree.

Quoted 31 lines

What's next:

- JuanJo Ciarliante's IPv6 patches for the transport layer. There are some merge conflicts here as well, which we need to solve. It's most probably due to different merge roots between our copies of the SVN tree.  I hope JJO and I can solve this soon, then it will go into the allmerged branch immediately.

Quoted 23 lines
Quoted 4 lines
Quoted 4 lines

Cool, thanks a lot for the heads-up.

I'll try to solve this before by next week,

I've just did a cut+merge, fyi I had to use:
  git-format-patch -k --stdout stock..master |git-am -3 -k (stock: my svn-import'd tree, master: my local head) , worked fine (b/c of the different svn-import history(?), git could not find a common ancestor, then the need to fallback to "diff | patch").
It also successful passes my tests as stated in README.ipv6.

I've pushed this to my github repo, so something in the lines of:
  git-remote add -f -t openvpn-testing-master+jjo-ipv6 \
     jjo-ipv6 git://github.com/jjo/openvpn-ipv6

+merge should be able to fast-forward your master head.

I still need to do some touches for allmerged, as we conflict w/ Gert's IPv6 patch on a mroute.c chunk IIRC.

Quoted 6 lines

Great!  Thank you for your work here!

I've created an feat_ipv6_transport branch where I'll track your patches.  Gert's IPv6 patches are in feat_ipv6_payload (which are also merged into the allmerged branch).  I've started the discussion about the merge conflict in another mail thread.

Coooool ! , tnx a lot.

Quoted 3 lines

It's all pushed out to the openvpn-testing.git, so please feel free to update me when you have solved these issues or have other updates!

I expect to find time during the weekend to resolve the small conflict and be able to inject-da-zing into allmerged.

Quoted 3 lines

kind regards,

Cheers,

Quoted 11 lines

David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkt+crAACgkQDC186MBRfroDNgCgsZwPBeAFzR44FB34Xv0HInAr 46EAoKZtDgoSvqQIzpQu5XNEygaA7ccs
=rqXo
-----END PGP SIGNATURE-----

Signature · 1 line
--JuanJo ; echo [email protected]... | sed 's/[SPAM]//g'
#9 lore raw

Re: [Openvpn-devel] [PATCH] FQDN for routes should expand to all IPs

In reply to Karl O. Pinc

Hi

Quoted 4 lines · Karl O. Pinc

So, unless you're pulling names out of /etc/hosts it's likely that randomization does nothing. And if the bind administrator has gone to the extra work to enable a fixed ordering of RR records then randomization destroys his work.

That's entirely dependent on the DNS server. Some DNS servers do not randomize the order (so I've heard).

Moreover, if you consider that openvpn is mostly used to connect to central resources from a random location, you can not assume anything about the nameserver(s) you resolve through. Therefore even if you go through the trouble of enabling fixed ordering on your DNS, it is likely that the (caching) nameservers that the clients resolve through randomize the list sometimes and you will get unpredictable results anyway.

So IMO it would better to pick at random for load balancing (the case when ISP local nameserver caches and respons with a static list) as there is no obvious reason for fixed ordering and even if there were, it would not work anyway (unless used in a environment entirely under your control).

Siim

#10 lore raw

Re: [Openvpn-devel] [PATCH] FQDN for routes should expand to all IPs

Quoted 9 lines · Siim Põder

Hi

Quoted 4 lines · Karl O. Pinc

So, unless you're pulling names out of /etc/hosts it's likely that randomization does nothing. And if the bind administrator has gone to the extra work to enable a fixed ordering of RR records then randomization destroys his work.

That's entirely dependent on the DNS server.

Yes, entirely implementation dependent as noted.

Quoted 12 lines

Some DNS servers do not
randomize the order (so I've heard).

Moreover, if you consider that openvpn is mostly used to connect to central resources from a random location, you can not assume anything about the nameserver(s) you resolve through. Therefore even if you go through the trouble of enabling fixed ordering on your DNS, it is likely that the (caching) nameservers that the clients resolve through
randomize the list sometimes and you will get unpredictable results anyway.

Quoted 5 lines

So IMO it would better to pick at random for load balancing (the case when ISP local nameserver caches and respons with a static list) as there is no obvious reason for fixed ordering and even if there were, it would not work anyway (unless used in a environment entirely under your control).

I prefer the "Unix way" where each bit of software does one thing and does it well. This is a matter of taste, taste for modularity IMO. Leaving the choice regarding randomization to the resolver/dns server keeps the system modular and provides a centralized point of control. (Some people do have their dns entirely under their control.)

As you point out that there can be a legitimate need for randomization to provide control over load balancing from within the application. If this is an important enough feature then it should be just that, a feature that's dynamically configurable in OpenVPN's config file and designed to do something specific. In this case it might, possibly, make more sense to be able to specify the address pool within the config file, or pushed to the client in some fashion (caching between openvpn invocations would obviously be required), etc. Options regarding randomized choice, cycling, etc. could also be provided. One of those options could also be a fixed fallback sequence, so that instead of load balancing you get failover. (This is all blue-sky thinking, I've not steeped myself in OpenVPN enough of late to be sure how any of this would work.)

Implementing randomization as a configurable feature gets you the best of both worlds. Somebody other than me needs to decide if the added feature creep is worth it.

Regards,

Karl <[email protected]...>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#13 lore raw

Re: [Openvpn-devel] [PATCH] FQDN for routes should expand to all IPs

In reply to David Sommerseth
Quoted 10 lines · David Sommerseth
Quoted 2 lines · Stefan Monnier

If it's a config var, it could indeed just be a global var, so I

don't

Quoted 1 line

think it would be very complex. But that's really not something

the

Quoted 1 line

user should have to configure.

That depends on the solution we end up with.

What do you mean "configure"?

This is exactly the sort of thing that a

./configure --connection-limit=20

sort of configuration setting is good for. Someone might want to frob it, but does it need to be dynamically configurable in the openvpn config file? If you make the default large enough for anybody then the embedded systems people can reconfigure their binary to shrink it need be.

Regards,

Karl <[email protected]...>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#14 lore raw

Re: [Openvpn-devel] [PATCH] FQDN for routes should expand to all IPs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 16 lines · Karl O. Pinc
Quoted 10 lines · David Sommerseth
Quoted 2 lines · Stefan Monnier

If it's a config var, it could indeed just be a global var, so I

don't

Quoted 1 line

think it would be very complex. But that's really not something

the

Quoted 1 line

user should have to configure.

That depends on the solution we end up with.

What do you mean "configure"?

This is exactly the sort of thing that a

Quoted 7 lines

./configure --connection-limit=20

sort of configuration setting is good for. Someone might want to frob it, but does it need to be dynamically configurable in the openvpn config file? If you make the default large enough for anybody then the embedded systems people can reconfigure their binary to shrink it need be.

I initially meant a more dynamic approach, changing it via the config file at runtime - by modifying a global C variable. But I agree, doing it via the ./configure script should really be sufficient. This makes more sense for me now.

kind regards,

David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkt+udMACgkQDC186MBRfroXRwCfX/qmYT1iuB8A8h/Nano7ZaNe CrYAnjo/zrx+dmXuqo2hdEocTRLSl6dh
=qOkR
-----END PGP SIGNATURE-----

#15 lore raw

Re: [Openvpn-devel] [PATCH] FQDN for routes should expand to all IPs

Hi,

Quoted 3 lines · David Sommerseth

I initially meant a more dynamic approach, changing it via the config file at runtime - by modifying a global C variable. But I agree, doing it via the ./configure script should really be sufficient.

ACK.

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#16 lore raw

Re: [Openvpn-devel] [PATCH] FQDN for routes should expand to all IPs

In reply to David Sommerseth
Quoted 5 lines · David Sommerseth

Unfortunately, it's running on a lot of different embedded systems. OpenWRT and dd-wrt are just two of many firmwares which ships it. I would not be surprised if somebody have made VoIP hardware phones which includes OpenVPN. And these phones could in theory even be in the 4-8MB segment.

JFTR: http://wiki.snom.com/Networking/Virtual_Private_Network_%28VPN%29

They have 32MB RAM, but it is fairly packed already.

Best Regards,
Bernhard

#22 lore raw
In reply to JuanJo Ciarlante

Hey David,

Quoted 61 lines · JuanJo Ciarlante

Hey David,

Quoted 57 lines · David Sommerseth

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 52 lines · JuanJo Ciarlante
Quoted 4 lines · JuanJo Ciarlante
Quoted 4 lines

Hi David,

On Tue, Feb 16, 2010 at 7:49 PM, David Sommerseth
<[email protected]...> wrote:

Greetings all!

I am now announcing the openvpn-testing.git tree as open.  Gert has already been announcing the availability as a response to some merge conflicts.  Anyhow, those issues are solved.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

\o/ !

The tree is also tagged with all 2.1 releases and RC releases.  I have not bothered with tagging the 2.1 beta or any 2.0 releases at all.  If somebody finds it useful and wants it, please generate a list of tag names and commit ID's and I'll update the tree.

What's next:

- JuanJo Ciarliante's IPv6 patches for the transport layer. There are some merge conflicts here as well, which we need to solve. It's most probably due to different merge roots between our copies of the SVN tree.  I hope JJO and I can solve this soon, then it will go into the allmerged branch immediately.

Quoted 23 lines
Quoted 4 lines
Quoted 4 lines

Cool, thanks a lot for the heads-up.

I'll try to solve this before by next week,

I've just did a cut+merge, fyi I had to use:
  git-format-patch -k --stdout stock..master |git-am -3 -k (stock: my svn-import'd tree, master: my local head) , worked fine (b/c of the different svn-import history(?), git could not find a common ancestor, then the need to fallback to "diff | patch").
It also successful passes my tests as stated in README.ipv6.

I've pushed this to my github repo, so something in the lines of:
  git-remote add -f -t openvpn-testing-master+jjo-ipv6 \
     jjo-ipv6 git://github.com/jjo/openvpn-ipv6

+merge should be able to fast-forward your master head.

I still need to do some touches for allmerged, as we conflict w/ Gert's IPv6 patch on a mroute.c chunk IIRC.

Quoted 12 lines
Quoted 6 lines

Great!  Thank you for your work here!

I've created an feat_ipv6_transport branch where I'll track your patches.  Gert's IPv6 patches are in feat_ipv6_payload (which are also merged into the allmerged branch).  I've started the discussion about the merge conflict in another mail thread.

Coooool ! , tnx a lot.

Quoted 3 lines

It's all pushed out to the openvpn-testing.git, so please feel free to update me when you have solved these issues or have other updates!

I've added a new openvpn-testing-allmerged+jjo-ipv6 branch with the conflict resolved at git://github.com/jjo/openvpn-ipv6, it should cleanly fast-forward allmerged's head.

Thanks again for all your work on this!

Quoted 27 lines

I expect to find time during the weekend to resolve the small conflict and be able to inject-da-zing into allmerged.

Quoted 3 lines

kind regards,

Cheers,

Quoted 11 lines

David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkt+crAACgkQDC186MBRfroDNgCgsZwPBeAFzR44FB34Xv0HInAr 46EAoKZtDgoSvqQIzpQu5XNEygaA7ccs
=rqXo
-----END PGP SIGNATURE-----

--
--JuanJo ; echo [email protected]... | sed 's/[SPAM]//g'

Signature · 1 line
--JuanJo ; echo [email protected]... | sed 's/[SPAM]//g'
#23 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 8 lines · JuanJo Ciarlante

Hey David,

On Fri, Feb 19, 2010 at 12:29 PM, JuanJo Ciarlante <[email protected]...> wrote:
I've created an feat_ipv6_transport branch where I'll track your patches. Gert's IPv6 patches are in feat_ipv6_payload (which are also merged into the allmerged branch). I've started the discussion about the merge conflict in another mail thread.

Quoted 1 line
Quoted 1 line
Quoted 11 lines
Quoted 2 lines
Quoted 2 lines

Coooool ! , tnx a lot.

It's all pushed out to the openvpn-testing.git, so please feel free to update me when you have solved these issues or have other updates!

Quoted 5 lines

I've added a new openvpn-testing-allmerged+jjo-ipv6 branch with the conflict resolved at git://github.com/jjo/openvpn-ipv6, it should cleanly fast-forward allmerged's head.

Thanks again for all your work on this!

Pulled and merged into allmerged :)

Kind regards,

David Sommerseth

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkuCRywACgkQDC186MBRfrokcQCdH7YDG738UpkskOTZzYp7uS+g qKQAn0NIBt0HvcY/DPidiNGbGzA1/jhQ
=odV8
-----END PGP SIGNATURE-----