diff options
author | Arne Schwabe <arne@rfc2549.org> | 2012-12-14 13:32:06 +0100 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2012-12-14 13:32:06 +0100 |
commit | f9ebb92a5111003482dac9dddcce926a1efb66bd (patch) | |
tree | 048312ca2d29c98f9337eec6579e9566ecbf06b3 /openvpn | |
parent | 76a0da0622b9bf04756f5ad39bc31759809e76ff (diff) |
proto_remote fix
Diffstat (limited to 'openvpn')
-rw-r--r-- | openvpn/src/openvpn/options.c | 2 | ||||
-rw-r--r-- | openvpn/src/openvpn/socket.c | 20 | ||||
-rw-r--r-- | openvpn/src/openvpn/socket.h | 2 |
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); /* |