]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
wireguard: Accept FQDNs as endpoints
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 6 Dec 2024 16:13:53 +0000 (17:13 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 22 Apr 2025 14:48:53 +0000 (16:48 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/cfgroot/wireguard-functions.pl
html/cgi-bin/wireguard.cgi

index ee4b2d1dec68caf5214a8640463b3685c77b63c3..a3078a24fd8905127f736d8062297128426a0af8 100644 (file)
@@ -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'});
index d27efc8eeedf448b48762f1d7ffbacd43ab33e64..9635be1267a9100975931da8f721118918aed79e 100644 (file)
@@ -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'});
        }