mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
Add port parameter to dns_notify_create()
The DSYNC record has a Port rdata field, so NOTIFY(CDS) messages may be configured at different ports. When creating a new notify, allow for specifying the port.
This commit is contained in:
parent
dda2e99c36
commit
121d372236
3 changed files with 28 additions and 19 deletions
|
|
@ -51,6 +51,7 @@ struct dns_notify {
|
|||
dns_adbfind_t *find;
|
||||
dns_request_t *request;
|
||||
dns_name_t ns;
|
||||
in_port_t port;
|
||||
isc_sockaddr_t src;
|
||||
isc_sockaddr_t dst;
|
||||
dns_tsigkey_t *key;
|
||||
|
|
@ -76,7 +77,8 @@ dns_notifyctx_init(dns_notifyctx_t *nctx, dns_rdatatype_t type);
|
|||
*/
|
||||
|
||||
void
|
||||
dns_notify_create(isc_mem_t *mctx, unsigned int flags, dns_notify_t **notifyp);
|
||||
dns_notify_create(isc_mem_t *mctx, in_port_t port, unsigned int flags,
|
||||
dns_notify_t **notifyp);
|
||||
/*%<
|
||||
* Create a notify structure to maintain state.
|
||||
*
|
||||
|
|
@ -96,14 +98,14 @@ dns_notify_destroy(dns_notify_t *notify, bool zone_locked);
|
|||
*/
|
||||
|
||||
bool
|
||||
dns_notify_isqueued(dns_notifyctx_t *nctx, unsigned int flags, dns_name_t *name,
|
||||
isc_sockaddr_t *addr, dns_tsigkey_t *key,
|
||||
dns_notify_isqueued(dns_notifyctx_t *nctx, in_port_t port, unsigned int flags,
|
||||
dns_name_t *name, isc_sockaddr_t *addr, dns_tsigkey_t *key,
|
||||
dns_transport_t *transport);
|
||||
/*%<
|
||||
* Check if we already have a notify queued matching name, destination
|
||||
* address, TSIG key, and transport. Will requeue on the normal notify
|
||||
* ratelimiter if the notify was enqueued on the startup ratelimiter and
|
||||
* this is not a startup notify.
|
||||
* address and port, TSIG key, and transport. Will requeue on the normal
|
||||
* notify ratelimiter if the notify was enqueued on the startup ratelimiter
|
||||
* and this is not a startup notify.
|
||||
*
|
||||
* Requires:
|
||||
* 'nctx' is not NULL
|
||||
|
|
|
|||
|
|
@ -53,7 +53,8 @@ dns_notifyctx_init(dns_notifyctx_t *nctx, dns_rdatatype_t type) {
|
|||
}
|
||||
|
||||
void
|
||||
dns_notify_create(isc_mem_t *mctx, unsigned int flags, dns_notify_t **notifyp) {
|
||||
dns_notify_create(isc_mem_t *mctx, in_port_t port, unsigned int flags,
|
||||
dns_notify_t **notifyp) {
|
||||
dns_notify_t *notify;
|
||||
|
||||
REQUIRE(notifyp != NULL && *notifyp == NULL);
|
||||
|
|
@ -61,6 +62,7 @@ dns_notify_create(isc_mem_t *mctx, unsigned int flags, dns_notify_t **notifyp) {
|
|||
notify = isc_mem_get(mctx, sizeof(*notify));
|
||||
*notify = (dns_notify_t){
|
||||
.flags = flags,
|
||||
.port = port,
|
||||
};
|
||||
|
||||
isc_mem_attach(mctx, ¬ify->mctx);
|
||||
|
|
@ -525,8 +527,8 @@ dns_notify_queue(dns_notify_t *notify, bool startup) {
|
|||
}
|
||||
|
||||
bool
|
||||
dns_notify_isqueued(dns_notifyctx_t *nctx, unsigned int flags, dns_name_t *name,
|
||||
isc_sockaddr_t *addr, dns_tsigkey_t *key,
|
||||
dns_notify_isqueued(dns_notifyctx_t *nctx, in_port_t port, unsigned int flags,
|
||||
dns_name_t *name, isc_sockaddr_t *addr, dns_tsigkey_t *key,
|
||||
dns_transport_t *transport) {
|
||||
dns_notify_t *notify = NULL;
|
||||
isc_result_t result;
|
||||
|
|
@ -540,7 +542,8 @@ dns_notify_isqueued(dns_notifyctx_t *nctx, unsigned int flags, dns_name_t *name,
|
|||
if ((name != NULL && dns_name_dynamic(&n->ns) &&
|
||||
dns_name_equal(name, &n->ns)) ||
|
||||
(addr != NULL && isc_sockaddr_equal(addr, &n->dst) &&
|
||||
n->key == key && n->transport == transport))
|
||||
n->port == port && n->key == key &&
|
||||
n->transport == transport))
|
||||
{
|
||||
notify = n;
|
||||
goto requeue;
|
||||
|
|
@ -646,8 +649,8 @@ notify_send(dns_notify_t *notify) {
|
|||
|
||||
ISC_LIST_FOREACH(notify->find->list, ai, publink) {
|
||||
dst = ai->sockaddr;
|
||||
if (dns_notify_isqueued(notifyctx, notify->flags, NULL, &dst,
|
||||
NULL, NULL))
|
||||
if (dns_notify_isqueued(notifyctx, notify->port, notify->flags,
|
||||
NULL, &dst, NULL, NULL))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
@ -656,7 +659,8 @@ notify_send(dns_notify_t *notify) {
|
|||
}
|
||||
newnotify = NULL;
|
||||
flags = notify->flags & DNS_NOTIFY_NOSOA;
|
||||
dns_notify_create(notify->mctx, flags, &newnotify);
|
||||
dns_notify_create(notify->mctx, notify->port, flags,
|
||||
&newnotify);
|
||||
dns__zone_iattach_locked(notify->zone, &newnotify->zone);
|
||||
ISC_LIST_APPEND(notifyctx->notifies, newnotify, link);
|
||||
newnotify->dst = dst;
|
||||
|
|
@ -731,7 +735,7 @@ dns_notify_find_address(dns_notify_t *notify) {
|
|||
}
|
||||
|
||||
result = dns_adb_createfind(adb, loop, process_notify_adb_event, notify,
|
||||
¬ify->ns, options, 0, view->dstport, 0,
|
||||
¬ify->ns, options, 0, notify->port, 0,
|
||||
NULL, NULL, NULL, ¬ify->find);
|
||||
dns_adb_detach(&adb);
|
||||
|
||||
|
|
|
|||
|
|
@ -12598,8 +12598,8 @@ zone_notify(dns_zone_t *zone, isc_time_t *now) {
|
|||
goto next;
|
||||
}
|
||||
|
||||
if (dns_notify_isqueued(&zone->notifysoa, flags, NULL, &dst,
|
||||
key, transport))
|
||||
if (dns_notify_isqueued(&zone->notifysoa, zone->view->dstport,
|
||||
flags, NULL, &dst, key, transport))
|
||||
{
|
||||
if (key != NULL) {
|
||||
dns_tsigkey_detach(&key);
|
||||
|
|
@ -12610,7 +12610,8 @@ zone_notify(dns_zone_t *zone, isc_time_t *now) {
|
|||
goto next;
|
||||
}
|
||||
|
||||
dns_notify_create(zone->mctx, flags, ¬ify);
|
||||
dns_notify_create(zone->mctx, zone->view->dstport, flags,
|
||||
¬ify);
|
||||
zone_iattach(zone, ¬ify->zone);
|
||||
notify->src = src;
|
||||
notify->dst = dst;
|
||||
|
|
@ -12687,13 +12688,15 @@ zone_notify(dns_zone_t *zone, isc_time_t *now) {
|
|||
}
|
||||
|
||||
LOCK_ZONE(zone);
|
||||
isqueued = dns_notify_isqueued(&zone->notifysoa, flags,
|
||||
isqueued = dns_notify_isqueued(&zone->notifysoa,
|
||||
zone->view->dstport, flags,
|
||||
&ns.name, NULL, NULL, NULL);
|
||||
UNLOCK_ZONE(zone);
|
||||
if (isqueued) {
|
||||
continue;
|
||||
}
|
||||
dns_notify_create(zone->mctx, flags, ¬ify);
|
||||
dns_notify_create(zone->mctx, zone->view->dstport, flags,
|
||||
¬ify);
|
||||
dns_zone_iattach(zone, ¬ify->zone);
|
||||
dns_name_dup(&ns.name, zone->mctx, ¬ify->ns);
|
||||
LOCK_ZONE(zone);
|
||||
|
|
|
|||
Loading…
Reference in a new issue