Skip to contentSkip to conversation

Fix the proto is used inconsistently warning

PATCH Applied Arne Schwabe 3 participants 5 messages Dec 4, 2012 – Dec 17, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix the proto is used inconsistently warning

Fix the "WARNING: 'proto' is used inconsistently, local='proto UDP', remote='proto UDPv6'." message.

Note that the on wire strings are now always TCPv4 and UDPv4 to be compatible to pre2.3

---
 src/openvpn/socket.c |   22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
src/openvpn/socket.c +18 -4
index 505cf3b..2adfe8a 100644
@@ -2560,6 +2560,10 @@ addr_family_name (int af)
  *
  * This is used for options compatibility
  * checking.
+ *
+ * IPv6 and IPv4 protocols are comptabile but OpenVPN
+ * has always sent UDPv4, TCPv4 over the wire. Keep these 
+ * strings for backward compatbility
  */
 int
 proto_remote (int proto, bool remote)
@@ -2569,10 +2573,20 @@ proto_remote (int proto, bool remote)
     {
       switch (proto)
       {
-	case PROTO_TCPv4_SERVER: return PROTO_TCPv4_CLIENT;
-	case PROTO_TCPv4_CLIENT: return PROTO_TCPv4_SERVER;
-	case PROTO_TCPv6_SERVER: return PROTO_TCPv6_CLIENT;
-	case PROTO_TCPv6_CLIENT: return PROTO_TCPv6_SERVER;
+      case PROTO_TCPv4_SERVER: return PROTO_TCPv4_CLIENT;
+      case PROTO_TCPv4_CLIENT: return PROTO_TCPv4_SERVER;
+      case PROTO_TCPv6_SERVER: return PROTO_TCPv4_CLIENT;
+      case PROTO_TCPv6_CLIENT: return PROTO_TCPv4_SERVER;
+      case PROTO_UDPv6: return PROTO_UDPv4;
+      }
+    }
+  else
+    {
+      switch (proto)
+      {
+      case PROTO_TCPv6_SERVER: return PROTO_TCPv4_SERVER;
+      case PROTO_TCPv6_CLIENT: return PROTO_TCPv4_CLIENT;
+      case PROTO_UDPv6: return PROTO_UDPv4;
       }
     }
   return proto;
Signature · 1 line
1.7.9.5
#1 lore raw

Hi,

Quoted 3 lines · Arne Schwabe

Fix the "WARNING: 'proto' is used inconsistently, local='proto UDP', remote='proto UDPv6'." message.

Note that the on wire strings are now always TCPv4 and UDPv4 to be compatible to pre2.3

The patch does what advertised, so I ACK it, and it should go into 2.3

OTOH, I want to put up the question whether sending "proto foo" in the occ option string is of any use *at all* - because if the --proto setting on both ends do not match, the connection won't even reach the point where it could recognize the fact that "oh, it's because incompatible --proto settings!". So to achieve a null-feature, we have quite a bit of code in "proto_remote()" in socket.c...

"Just throwing it out" for 2.3 will cause warnings with pre-2.3 clients connecting to a (hypothetical) 2.3 server which does not send "proto", (or vice versa).

What could do is to add some more code (sigh) to make OpenVPN 2.3 *ignore* proto mismatches and missing "proto foo" strings in OCC, and stop sending it in 2.4 altogether (so a 2.3<->2.4 combination would not warn, and if 2.2<->2.4 warns, put it into the FAQ).

Maybe we should also add the same time stop warning about tun-ipv6 mismatches, because the case where there server has tun-ipv6 configured, and the client learns it due to "push tun-ipv6" will cause a useless warning today...

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]...
#2 lore raw

PATCH 1/1 Fix option inconsistency warnings about "proto" and "tun-ipv6"

"tun-ipv6" is only sent in option string if running in point-to-point mode (= not --server and not --client or --pull), because in those scenarios it's usually pushed by the server, and the client does not yet have it when comparing options -> needless warning.

Completely ignore "proto" values when comparing option strings - this is in preparation for removing proto from the option string in a future release, and to avoid warnings when 2.3 talks to this future release.

---
 src/openvpn/options.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
src/openvpn/options.c +11 -1
index 33dbf51..a07ff49 100644
@@ -2917,7 +2917,11 @@ options_string (const struct options *o,
   buf_printf (&out, ",link-mtu %d", EXPANDED_SIZE (frame));
   buf_printf (&out, ",tun-mtu %d", PAYLOAD_SIZE (frame));
   buf_printf (&out, ",proto %s", proto2ascii (proto_remote (o->ce.proto, remote), true));
-  if (o->tun_ipv6)
+
+  /* send tun_ipv6 only in peer2peer mode - in client/server mode, it
+   * is usually pushed by the server, triggering a non-helpful warning
+   */
+  if (o->tun_ipv6 && o->mode == MODE_POINT_TO_POINT && !PULL_DEFINED(o))
     buf_printf (&out, ",tun-ipv6");
 
   /*
@@ -3097,6 +3101,12 @@ options_warning_safe_scan2 (const int msglevel,
 			    const char *b1_name,
 			    const char *b2_name)
 {
+  /* we will stop sending 'proto xxx' in OCC in a future version
+   * (because it's not useful), and to reduce questions when
+   * interoperating, we start not-printing a warning about it today
+   */
+  if (strncmp(p1, "proto ", 6) == 0 ) return;
+
   if (strlen (p1) > 0)
     {
       struct gc_arena gc = gc_new ();
Signature · 1 line
1.7.8.6
#3 lore raw

Re: [Openvpn-devel] [PATCH] Fix option inconsistency warnings about "proto" and "tun-ipv6"

Quoted 5 lines · Gert Doering

"tun-ipv6" is only sent in option string if running in point-to-point mode (= not --server and not --client or --pull), because in those scenarios it's usually pushed by the server, and the client does not yet have it when comparing options -> needless warning.

Quoted 8 lines

Completely ignore "proto" values when comparing option strings - this is in preparation for removing proto from the option string in a future release, and to avoid warnings when 2.3 talks to this future release.

---
 src/openvpn/options.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

ACK. Applied to master and beta/2.3

commit 3b860cf27b9374f6ebe67ff21011661f8ec391c6 (master) commit f21410729e68b553f391dc036c0372fd3690714e (beta/2.3)

Author: Gert Doering <[email protected]...>
Date:   Sun Dec 16 22:15:20 2012 +0100
    Fix option inconsistency warnings about "proto" and "tun-ipv6"

    Signed-off-by: Gert Doering <[email protected]...>
    Acked-by: David Sommerseth <[email protected]...>
    Message-Id: [email protected]...
    URL: http://article.gmane.org/gmane.network.openvpn.devel/7194
    Signed-off-by: David Sommerseth <[email protected]...>
Signature · 3 lines
kind regards,

David Sommerseth
#4 lore raw
In reply to Arne Schwabe
Quoted 8 lines · Arne Schwabe

Fix the "WARNING: 'proto' is used inconsistently, local='proto UDP', remote='proto UDPv6'." message.

Note that the on wire strings are now always TCPv4 and UDPv4 to be compatible to pre2.3

---
 src/openvpn/socket.c |   22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

Applied to master and beta/2.3

commit 38727e09df35245ba0cfe335e23e6b43c817ce58 (master) commit 34bc52d611deec62e7fe56622771b58921d52176 (beta/2.3)

Author: Arne Schwabe <[email protected]...>
Date:   Tue Dec 4 20:42:54 2012 +0100
    Fix the proto is used inconsistently warning

    Signed-off-by: Arne Schwabe <[email protected]...>
    Acked-by: Gert Doering <[email protected]...>
    Message-Id: [email protected]...
    URL: http://article.gmane.org/gmane.network.openvpn.devel/7175
    Signed-off-by: David Sommerseth <[email protected]...>
Signature · 3 lines
kind regards,

David Sommerseth