]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Fix the proto is used inconsistently warning
authorArne Schwabe <arne@rfc2549.org>
Tue, 4 Dec 2012 19:42:54 +0000 (20:42 +0100)
committerDavid Sommerseth <davids@redhat.com>
Thu, 13 Dec 2012 15:40:12 +0000 (16:40 +0100)
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

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: 1354650174-25601-1-git-send-email-arne@rfc2549.org
URL: http://article.gmane.org/gmane.network.openvpn.devel/7175
Signed-off-by: David Sommerseth <davids@redhat.com>
src/openvpn/socket.c

index 21a4b2bff18987ab231c85af328bc6a7258ce7a3..8eb112bf319bd2085f630879e21615cb69a5b70c 100644 (file)
@@ -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;