diff options
author | Phil Davis <phil.davis@inf.org> | 2016-04-05 11:34:01 +0545 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-04-05 09:39:01 -0300 |
commit | 11614bc904eb8a3588b09404ff615b2f8cd0c16a (patch) | |
tree | 32a35c6489b743ea6c8bc74771032f3c8dbb85a2 | |
parent | 73ff9530d1a19c118b6c18ecda398b02002c52e0 (diff) | |
download | pfsense-11614bc904eb8a3588b09404ff615b2f8cd0c16a.zip pfsense-11614bc904eb8a3588b09404ff615b2f8cd0c16a.tar.gz |
Handle alias from CNAME in diag_dns
If I resolve a CNAME with diag_dns, it gives back the translated FQDNs - e.g. www.inf.org translates to inf.org. Then press "Add Alias".
Problem: The existing code puts a "/32" CIDR after that in the alias "www_inf_org" in the config - "inf.org./32" - and if you then edit the "www_inf_org" alias it shows as "inf.org./32" in the Network or FQDN Address field. Normally when putting an FQDN into an alias, no CIDR is inserted.
This change fixes it.
(cherry picked from commit 607b785f637e5b10f51174061242a8a599410796)
-rwxr-xr-x | src/usr/local/www/diag_dns.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/usr/local/www/diag_dns.php b/src/usr/local/www/diag_dns.php index 177949e..18cc1bf 100755 --- a/src/usr/local/www/diag_dns.php +++ b/src/usr/local/www/diag_dns.php @@ -97,7 +97,13 @@ if (isset($_POST['create_alias']) && (is_hostname($host) || is_ipaddr($host))) { $addresses .= " "; } $re = rtrim($re); - $sn = is_ipaddrv6($re) ? '/128' : '/32'; + if (is_ipaddr($re)) { + $sn = is_ipaddrv6($re) ? '/128' : '/32'; + } else { + // The name was a CNAME and resolved to another name, rather than an address. + // In this case the alias entry will have a FQDN, so do not put a CIDR after it. + $sn = ""; + } $addresses .= $re . $sn; $isfirst = false; } |