mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
Added check for RR type
Now, if the RR for a hostname has both IPv4 and IPv6 addresses, the correct RR is chosen by the current RR type.
This commit is contained in:
parent
38e1924209
commit
c6fbdd45fc
1 changed files with 15 additions and 2 deletions
|
|
@ -653,8 +653,21 @@ class updatedns
|
|||
|
||||
/* Get IP for your hostname in Route 53 */
|
||||
if (false !== ($a_result = SearchRecords($records['ResourceRecordSets'], "$hostname"))) {
|
||||
$OldTTL=$a_result[0][TTL];
|
||||
$OldIP=$a_result[0][ResourceRecords][0];
|
||||
/**
|
||||
* if hostname for ipv4 and ipv6 is the same, a_result contains more than 1 item
|
||||
* we need to get the item that corresponds to the record type
|
||||
*/
|
||||
$oldTTLResult = null;
|
||||
$oldIPResult = null;
|
||||
foreach ($a_result as $resultItem) {
|
||||
if ($RecordType === $resultItem['Type']) {
|
||||
$oldTTLResult = $resultItem[TTL];
|
||||
$oldIPResult = $resultItem[ResourceRecords][0];
|
||||
}
|
||||
}
|
||||
|
||||
$OldTTL=$oldTTLResult;
|
||||
$OldIP=$oldIPResult;
|
||||
} else {
|
||||
$OldIP="";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue