/*
*
* Copyright (C) 2009-2015 Red Hat ; see COPYRIGHT for license
*/
#include <config.h>
#include <isc/eventclass.h>
#include "instance.h"
#include "syncptr.h"
#include "util.h"
/* Almost random value. See eventclass.h */
/*
* Event used for making changes to reverse zones.
*/
struct syncptrevent {
isc_buffer_t b; /* referenced by target name in tuple */
};
/*
* Write diff generated in syncptr() to reverse zone.
*
* This function will be called asynchronously and syncptr() will not get
* any result from it.
*
*/
static void
dns_db_detach(&db);
}
}
/*
* Find a reverse zone for given IP address.
*
* @param[out] name Owner name for the PTR record
* @param[out] zone DNS zone for reverse record matching the IP address
*
* @retval ISC_R_SUCCESS DNS name derived from given IP address belongs to an
* reverse zone managed by this driver instance.
* PTR record synchronization can continue.
* @retval ISC_R_NOTFOUND Suitable reverse zone was not found because it
* does not exist or is not managed by this driver.
*/
static isc_result_t
{
case dns_rdatatype_a:
break;
case dns_rdatatype_aaaa:
break;
default:
break;
}
/*
* Convert IP address to PTR owner name.
*
* @example
* 192.168.0.1 -> 1.0.168.192.in-addr.arpa
*/
/* Find a zone containing owner name of the PTR record. */
if (result == DNS_R_PARTIALMATCH)
else if (result != ISC_R_SUCCESS)
goto cleanup;
/* Make sure that the zone is managed by this driver. */
}
else
return (result);
}
/*
*
* @pre Reverse zone is managed by this driver.
*
* @param[in] af Address family
* @param[in] ip_str IP address as a string (IPv4 or IPv6)
*
* @retval ISC_R_SUCCESS Event for PTR record update was generated and send.
* Change to reverse zone will be done asynchronously.
* @retval other Synchronization failed - reverse doesn't exist,
* is not managed by this driver instance,
* memory allocation error, etc.
*/
static isc_result_t
{
sizeof(syncptrevent_t));
goto cleanup;
}
/* Check if reverse zone is managed by this driver */
if (result != ISC_R_SUCCESS) {
log_error_r("PTR record synchonization skipped: reverse zone "
"is not managed by driver instance '%s'",
goto cleanup;
}
/* Reverse zone is managed by this driver, prepare PTR record */
NULL));
&ptr_struct.ptr);
/* Create diff */
/*
* Send update event to the reverse zone.
* It will be processed asynchronously.
*/
return (result);
}
/*
* Generate update event for every rdata in rdataset.
*
* @param[in] op DNS_DIFFOP_ADD / DNS_DIFFOP_DEL for adding / deleting
* the rdata
*/
{
result == ISC_R_SUCCESS;
goto cleanup;
}
if (result == ISC_R_NOMORE)
return (result);
}