aboutsummaryrefslogtreecommitdiff
path: root/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'socket.c')
-rw-r--r--socket.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/socket.c b/socket.c
index a7ed55f..9622637 100644
--- a/socket.c
+++ b/socket.c
@@ -294,6 +294,17 @@ ip_addr_dotted_quad_safe (const char *dotted_quad)
}
}
+bool
+ip_or_dns_addr_safe (const char *dotted_quad, const bool allow_fqdn)
+{
+ if (ip_addr_dotted_quad_safe (dotted_quad))
+ return true;
+ else if (allow_fqdn)
+ return string_class (dotted_quad, CC_NAME|CC_DASH|CC_DOT, 0);
+ else
+ return false;
+}
+
static void
update_remote (const char* host,
struct openvpn_sockaddr *addr,