Revision 0b3052b3
Added by Marcos M over 1 year ago
src/etc/inc/system.inc | ||
---|---|---|
1225 | 1225 |
if (preg_match('/}$/', $line)) { |
1226 | 1226 |
if ($lease) { |
1227 | 1227 |
if ($dnsavailable && empty($item['hostname'])) { |
1228 |
$hostname = check_dnsavailable($item['ip']);
|
|
1228 |
$hostname = resolve_address($item['ip']);
|
|
1229 | 1229 |
if (!empty($hostname)) { |
1230 | 1230 |
$item['hostname'] = $hostname; |
1231 | 1231 |
} |
... | ... | |
3288 | 3288 |
} |
3289 | 3289 |
|
3290 | 3290 |
/** |
3291 |
* Checks for DNS A/AAAA/SRV/PTR records.
|
|
3291 |
* Verifies the existence of a DNS A/AAAA/SRV/PTR record for an address.
|
|
3292 | 3292 |
* |
3293 |
* @param string $address Hostname or IPv4/6 address to check.
|
|
3293 |
* @param string $address Name or IPv4/6 address to check.
|
|
3294 | 3294 |
* |
3295 |
* @return string The hostname of the given IP address, or the unmodified address. |
|
3296 |
* @return false No DNS records found. |
|
3295 |
* @return string The address can be resolved. If $address is an IP address, |
|
3296 |
* return the reverse lookup name, otherwise return the |
|
3297 |
* unmodified input if it's a host/domain name. |
|
3298 |
* @return false Cannot resolve - no records found. |
|
3297 | 3299 |
*/ |
3298 |
function check_dnsavailable(?string $address): string|false {
|
|
3300 |
function resolve_address(?string $address): string|false {
|
|
3299 | 3301 |
if (empty($address)) { |
3300 | 3302 |
return false; |
3301 | 3303 |
} |
Also available in: Unified diff
Clarify function use and description