From 55183b176a1bbbbd2f936934781c31314b280068 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Tue, 26 Nov 2013 10:52:16 +0100 Subject: Update OpenVPN code --- openvpn/src/openvpn/forward.c | 2 +- openvpn/src/openvpn/options.c | 2 +- openvpn/src/openvpn/ps.c | 2 +- openvpn/src/openvpn/socket.c | 29 +++++++++++++++-------------- openvpn/src/openvpn/socket.h | 4 ++-- openvpn/src/openvpn/socks.c | 6 +++--- openvpn/tests/t_client.sh.in | 2 +- 7 files changed, 24 insertions(+), 23 deletions(-) (limited to 'openvpn') diff --git a/openvpn/src/openvpn/forward.c b/openvpn/src/openvpn/forward.c index 9fcae11b..0ec00f34 100644 --- a/openvpn/src/openvpn/forward.c +++ b/openvpn/src/openvpn/forward.c @@ -1122,7 +1122,7 @@ process_outgoing_link (struct context *c) fprintf (stderr, "W"); #endif msg (D_LINK_RW, "%s WRITE [%d] to %s: %s", - proto2ascii (c->c2.link_socket->info.proto, c->c2.link_socket->info.proto, true), + proto2ascii (c->c2.link_socket->info.proto, c->c2.link_socket->info.af, true), BLEN (&c->c2.to_link), print_link_socket_actual (c->c2.to_link_addr, &gc), PROTO_DUMP (&c->c2.to_link, &gc)); diff --git a/openvpn/src/openvpn/options.c b/openvpn/src/openvpn/options.c index 6e9377ac..cfbbfb4f 100644 --- a/openvpn/src/openvpn/options.c +++ b/openvpn/src/openvpn/options.c @@ -2389,7 +2389,7 @@ options_postprocess_mutate_ce (struct options *o, struct connection_entry *ce) /* if protocol forcing is enabled, disable all protocols except for the forced one */ if (o->proto_force >= 0 && o->proto_force != ce->proto) ce->flags |= CE_DISABLED; - + /* * If --mssfix is supplied without a parameter, default * it to --fragment value, if --fragment is specified. diff --git a/openvpn/src/openvpn/ps.c b/openvpn/src/openvpn/ps.c index a57ac547..b22653b4 100644 --- a/openvpn/src/openvpn/ps.c +++ b/openvpn/src/openvpn/ps.c @@ -801,7 +801,7 @@ port_share_open (const char *host, /* * Get host's IP address */ - + status = openvpn_getaddrinfo (GETADDR_RESOLVE|GETADDR_HOST_ORDER|GETADDR_FATAL, host, port, 0, NULL, AF_INET, &ai); ASSERT (status==0); diff --git a/openvpn/src/openvpn/socket.c b/openvpn/src/openvpn/socket.c index c5f085f8..2605f854 100644 --- a/openvpn/src/openvpn/socket.c +++ b/openvpn/src/openvpn/socket.c @@ -155,7 +155,7 @@ openvpn_getaddrinfo (unsigned int flags, print_hostname = hostname; else print_hostname = "undefined"; - + if(servname) print_servname = servname; else @@ -173,10 +173,9 @@ openvpn_getaddrinfo (unsigned int flags, hints.ai_family = ai_family; hints.ai_flags = AI_NUMERICHOST; - if(flags & GETADDR_PASSIVE) hints.ai_flags |= AI_PASSIVE; - + if(flags & GETADDR_DATAGRAM) hints.ai_socktype = SOCK_DGRAM; else @@ -192,7 +191,7 @@ openvpn_getaddrinfo (unsigned int flags, ((resolve_retry_seconds + 4)/ fail_wait_interval); const char *fmt; int level = 0; - + fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s)"; if ((flags & GETADDR_MENTION_RESOLVE_RETRY) && !resolve_retry_seconds) @@ -2266,10 +2265,10 @@ print_sockaddr_ex (const struct sockaddr *sa, { if (separator) buf_puts (&out, separator); - + buf_puts (&out, servname); } - + return BSTR (&out); } @@ -2550,7 +2549,7 @@ proto2ascii (int proto, sa_family_t af, bool display_form) unsigned int i; for (i = 0; i < SIZE (proto_names); ++i) { - if(proto_names[i].proto_af == af && proto_names[i].proto == proto) + if(proto_names[i].proto_af == af && proto_names[i].proto == proto) { if(display_form) return proto_names[i].display_form; @@ -2578,7 +2577,7 @@ proto2ascii_all (struct gc_arena *gc) } int -addr_guess_family(sa_family_t af, const char *name) +addr_guess_family(sa_family_t af, const char *name) { unsigned short ret; if (af) @@ -2630,10 +2629,12 @@ proto_remote (int proto, bool remote) ASSERT (proto >= 0 && proto < PROTO_N); if (proto == PROTO_UDP) return "UDPv4"; - - if ( (remote && proto == PROTO_TCP_CLIENT) || proto == PROTO_TCP_SERVER) + + if ( (remote && proto == PROTO_TCP_CLIENT) || + (!remote && proto == PROTO_TCP_SERVER)) return "TCPv4_SERVER"; - if ( (remote && proto == PROTO_TCP_SERVER) || proto == PROTO_TCP_CLIENT) + if ( (remote && proto == PROTO_TCP_SERVER) || + (!remote && proto == PROTO_TCP_CLIENT)) return "TCPv4_CLIENT"; ASSERT (0); @@ -2936,9 +2937,9 @@ socket_recv_queue (struct link_socket *sock, int maxsize) { sock->reads.addr_defined = true; if (sock->info.af == AF_INET) - sock->reads.addrlen = sizeof (sock->reads.addr6); - else sock->reads.addrlen = sizeof (sock->reads.addr); + else + sock->reads.addrlen = sizeof (sock->reads.addr6); status = WSARecvFrom( sock->sd, wsabuf, @@ -3034,7 +3035,7 @@ socket_send_queue (struct link_socket *sock, struct buffer *buf, const struct li { /* set destination address for UDP writes */ sock->writes.addr_defined = true; - if (sock->info.af == AF_INET) + if (sock->info.af == AF_INET6) { sock->writes.addr6 = to->dest.addr.in6; sock->writes.addrlen = sizeof (sock->writes.addr6); diff --git a/openvpn/src/openvpn/socket.h b/openvpn/src/openvpn/socket.h index 4c18b740..3f8318f5 100644 --- a/openvpn/src/openvpn/socket.h +++ b/openvpn/src/openvpn/socket.h @@ -309,8 +309,8 @@ link_socket_init_phase1 (struct link_socket *sock, const char *remote_host, const char *remote_port, int proto, - sa_family_t af, - bool bind_ipv6_only, + sa_family_t af, + bool bind_ipv6_only, int mode, const struct link_socket *accept_from, #ifdef ENABLE_HTTP_PROXY diff --git a/openvpn/src/openvpn/socks.c b/openvpn/src/openvpn/socks.c index 804c9836..1551da84 100644 --- a/openvpn/src/openvpn/socks.c +++ b/openvpn/src/openvpn/socks.c @@ -396,7 +396,7 @@ port_from_servname(const char* servname) port = atoi(servname); if(port >0 && port < 65536) return port; - + struct servent* service; service = getservbyname(servname, NULL); if(service) @@ -436,7 +436,7 @@ establish_socks_proxy_passthru (struct socks_proxy_info *p, msg (D_LINK_ERRORS, "establish_socks_proxy_passthrough: Cannot convert %s to port number", servname); goto error; } - + buf[5 + len] = (char) (port >> 8); buf[5 + len + 1] = (char) (port & 0xff); @@ -448,7 +448,7 @@ establish_socks_proxy_passthru (struct socks_proxy_info *p, goto error; } } - + /* receive reply from Socks proxy and discard */ if (!recv_socks_reply (sd, NULL, signal_received)) diff --git a/openvpn/tests/t_client.sh.in b/openvpn/tests/t_client.sh.in index 9b83e148..6c9de6c3 100755 --- a/openvpn/tests/t_client.sh.in +++ b/openvpn/tests/t_client.sh.in @@ -103,7 +103,7 @@ get_ifconfig_route() echo "-- linux iproute2 --" @IPROUTE@ addr show | grep -v valid_lft @IPROUTE@ route show - @IPROUTE@ -o -6 route show | grep -v ' cache' | sed -e 's/expires [0-9]*sec//' + @IPROUTE@ -o -6 route show | grep -v ' cache' | sed -E -e 's/ expires [0-9]*sec//' -e 's/ (mtu|hoplimit|cwnd) [0-9]+//g' -e 's/ (rtt|rttvar) [0-9]+ms//g' return fi -- cgit v1.2.3