summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-12-14 13:32:06 +0100
committerArne Schwabe <arne@rfc2549.org>2012-12-14 13:32:06 +0100
commit7411616612c3fdc34dbc77e00b727e25de02cfd3 (patch)
tree40a1272d8fcc5fa6e47b71211c382959c14ebdef
parentc0ada659bb13c0c008ff78cc31f9c65fe5ce55c2 (diff)
proto_remote fix
-rw-r--r--openvpn/src/openvpn/options.c2
-rw-r--r--openvpn/src/openvpn/socket.c20
-rw-r--r--openvpn/src/openvpn/socket.h2
3 files changed, 12 insertions, 12 deletions
diff --git a/openvpn/src/openvpn/options.c b/openvpn/src/openvpn/options.c
index dabc7577..158e155f 100644
--- a/openvpn/src/openvpn/options.c
+++ b/openvpn/src/openvpn/options.c
@@ -2889,7 +2889,7 @@ options_string (const struct options *o,
buf_printf (&out, ",dev-type %s", dev_type_string (o->dev, o->dev_type));
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),o->ce.af, true));
+ buf_printf (&out, ",proto %s", proto_remote (o->ce.proto, remote));
if (o->tun_ipv6)
buf_printf (&out, ",tun-ipv6");
diff --git a/openvpn/src/openvpn/socket.c b/openvpn/src/openvpn/socket.c
index c861fdd2..2f929ef6 100644
--- a/openvpn/src/openvpn/socket.c
+++ b/openvpn/src/openvpn/socket.c
@@ -2549,19 +2549,19 @@ addr_family_name (int af)
* has always sent UDPv4, TCPv4 over the wire. Keep these
* strings for backward compatbility
*/
-int
+const char*
proto_remote (int proto, bool remote)
{
ASSERT (proto >= 0 && proto < PROTO_N);
- if (remote)
- {
- switch (proto)
- {
- case PROTO_TCP_SERVER: return PROTO_TCP_CLIENT;
- case PROTO_TCP_CLIENT: return PROTO_TCP_SERVER;
- }
- }
- return proto;
+ if (proto == PROTO_UDP)
+ return "UDPv4";
+
+ if ( (remote && proto == PROTO_TCP_CLIENT) || proto == PROTO_TCP_SERVER)
+ return "TCPv4_SERVER";
+ if ( (remote && proto == PROTO_TCP_SERVER) || proto == PROTO_TCP_CLIENT)
+ return "TCPv4_CLIENT";
+
+ ASSERT (0);
}
/*
diff --git a/openvpn/src/openvpn/socket.h b/openvpn/src/openvpn/socket.h
index ae6cb9bc..33a59f0f 100644
--- a/openvpn/src/openvpn/socket.h
+++ b/openvpn/src/openvpn/socket.h
@@ -541,7 +541,7 @@ int ascii2proto (const char* proto_name);
sa_family_t ascii2af (const char* proto_name);
const char *proto2ascii (int proto, sa_family_t af, bool display_form);
const char *proto2ascii_all (struct gc_arena *gc);
-int proto_remote (int proto, bool remote);
+const char *proto_remote (int proto, bool remote);
const char *addr_family_name(int af);
/*