From: Michael Tremer Date: Fri, 6 Dec 2024 16:13:53 +0000 (+0100) Subject: wireguard: Accept FQDNs as endpoints X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5058edbadacd66e5313e4a1bbe9fca09aaace483;p=people%2Fstevee%2Fipfire-2.x.git wireguard: Accept FQDNs as endpoints Signed-off-by: Michael Tremer --- diff --git a/config/cfgroot/wireguard-functions.pl b/config/cfgroot/wireguard-functions.pl index ee4b2d1de..a3078a24f 100644 --- a/config/cfgroot/wireguard-functions.pl +++ b/config/cfgroot/wireguard-functions.pl @@ -501,6 +501,10 @@ sub parse_configuration($) { if (&Network::check_ip_address($address)) { # nothing + # Check if we have a valid FQDN + } elsif (&General::validfqdn($address)) { + # nothing + # Otherwise this fails } else { push(@errormessages, $Lang::tr{'invalid endpoint address'}); diff --git a/html/cgi-bin/wireguard.cgi b/html/cgi-bin/wireguard.cgi index d27efc8ee..9635be126 100644 --- a/html/cgi-bin/wireguard.cgi +++ b/html/cgi-bin/wireguard.cgi @@ -212,7 +212,11 @@ if ($cgiparams{"ACTION"} eq $Lang::tr{'save'}) { # Check the endpoint address if ($cgiparams{'ENDPOINT_ADDRESS'} eq '') { # The endpoint address may be empty - } elsif (!&Network::check_ip_address($cgiparams{'ENDPOINT_ADDRESS'})) { + } elsif (&General::validfqdn($cgiparams{'ENDPOINT_ADDRESS'})) { + # The endpoint is a valid FQDN + } elsif (&Network::check_ip_address($cgiparams{'ENDPOINT_ADDRESS'})) { + # The endpoint is a valid IP address + } else { push(@errormessages, $Lang::tr{'wg invalid endpoint address'}); }