From f9ebb92a5111003482dac9dddcce926a1efb66bd Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Fri, 14 Dec 2012 13:32:06 +0100 Subject: proto_remote fix --- openvpn/src/openvpn/options.c | 2 +- openvpn/src/openvpn/socket.c | 20 ++++++++++---------- openvpn/src/openvpn/socket.h | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'openvpn/src') 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); /* -- cgit v1.2.3