summaryrefslogtreecommitdiff
path: root/src/openvpn/socket.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-06-27 13:56:16 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-06-27 13:56:16 +0200
commit749384a154025e268b53cf3cc79eaeddde2b3ceb (patch)
tree27baa9e6aec76635d750405d90cd461440a656d1 /src/openvpn/socket.c
parentdb4f04c584f7d4e828b5d317cf40962b9d854ac5 (diff)
initial stretch branch release 2.4.0-6
Diffstat (limited to 'src/openvpn/socket.c')
-rw-r--r--src/openvpn/socket.c55
1 files changed, 22 insertions, 33 deletions
diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c
index 4e7e3f9..ae12832 100644
--- a/src/openvpn/socket.c
+++ b/src/openvpn/socket.c
@@ -16,9 +16,10 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
@@ -204,9 +205,7 @@ do_preresolve_host(struct context *c,
{
struct cached_dns_entry *prev = c->c1.dns_cache;
while (prev->next)
- {
prev = prev->next;
- }
prev->next = ph;
}
@@ -337,6 +336,20 @@ openvpn_getaddrinfo(unsigned int flags,
ASSERT(hostname || servname);
ASSERT(!(flags & GETADDR_HOST_ORDER));
+ if (hostname && (flags & GETADDR_RANDOMIZE))
+ {
+ hostname = hostname_randomize(hostname, &gc);
+ }
+
+ if (hostname)
+ {
+ print_hostname = hostname;
+ }
+ else
+ {
+ print_hostname = "undefined";
+ }
+
if (servname)
{
print_servname = servname;
@@ -387,20 +400,6 @@ openvpn_getaddrinfo(unsigned int flags,
const char *fmt;
int level = 0;
- if (hostname && (flags & GETADDR_RANDOMIZE))
- {
- hostname = hostname_randomize(hostname, &gc);
- }
-
- if (hostname)
- {
- print_hostname = hostname;
- }
- else
- {
- print_hostname = "undefined";
- }
-
fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s)";
if ((flags & GETADDR_MENTION_RESOLVE_RETRY)
&& !resolve_retry_seconds)
@@ -511,10 +510,6 @@ openvpn_getaddrinfo(unsigned int flags,
else
{
/* IP address parse succeeded */
- if (flags & GETADDR_RANDOMIZE)
- {
- msg(M_WARN, "WARNING: ignoring --remote-random-hostname because the hostname is an IP address");
- }
}
done:
@@ -1149,7 +1144,7 @@ tcp_connection_established(const struct link_socket_actual *act)
gc_free(&gc);
}
-static socket_descriptor_t
+static int
socket_listen_accept(socket_descriptor_t sd,
struct link_socket_actual *act,
const char *remote_dynamic,
@@ -1161,7 +1156,7 @@ socket_listen_accept(socket_descriptor_t sd,
struct gc_arena gc = gc_new();
/* struct openvpn_sockaddr *remote = &act->dest; */
struct openvpn_sockaddr remote_verify = act->dest;
- socket_descriptor_t new_sd = SOCKET_UNDEFINED;
+ int new_sd = SOCKET_UNDEFINED;
CLEAR(*act);
socket_do_listen(sd, local, do_listen, true);
@@ -2013,8 +2008,7 @@ static void
phase2_tcp_client(struct link_socket *sock, struct signal_info *sig_info)
{
bool proxy_retry = false;
- do
- {
+ do {
socket_connect(&sock->sd,
sock->info.lsa->current_remote->ai_addr,
get_server_poll_remaining_time(sock->server_poll_timeout),
@@ -2370,8 +2364,7 @@ link_socket_bad_incoming_addr(struct buffer *buf,
(int)from_addr->dest.addr.sa.sa_family,
print_sockaddr_ex(info->lsa->remote_list->ai_addr,":",PS_SHOW_PORT, &gc));
/* print additional remote addresses */
- for (ai = info->lsa->remote_list->ai_next; ai; ai = ai->ai_next)
- {
+ for (ai = info->lsa->remote_list->ai_next; ai; ai = ai->ai_next) {
msg(D_LINK_ERRORS,"or from peer address: %s",
print_sockaddr_ex(ai->ai_addr,":",PS_SHOW_PORT, &gc));
}
@@ -3060,12 +3053,10 @@ ascii2proto(const char *proto_name)
{
int i;
for (i = 0; i < SIZE(proto_names); ++i)
- {
if (!strcmp(proto_name, proto_names[i].short_form))
{
return proto_names[i].proto;
}
- }
return -1;
}
@@ -3074,12 +3065,10 @@ ascii2af(const char *proto_name)
{
int i;
for (i = 0; i < SIZE(proto_names); ++i)
- {
if (!strcmp(proto_name, proto_names[i].short_form))
{
return proto_names[i].proto_af;
}
- }
return 0;
}