• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-13-stable/contrib/unbound/services/

Lines Matching defs:xfr

96 static void xfr_set_timeout(struct auth_xfer* xfr, struct module_env* env,
99 static void xfr_probe_send_or_end(struct auth_xfer* xfr,
103 static int xfr_start_probe(struct auth_xfer* xfr, struct module_env* env,
106 static void auth_xfer_delete(struct auth_xfer* xfr);
1781 /** Find auth_zone SOA and populate the values in xfr(soa values). */
1783 xfr_find_soa(struct auth_zone* z, struct auth_xfer* xfr)
1797 xfr->have_zone = 1;
1798 xfr->serial = sldns_read_uint32(d->rr_data[0]+(d->rr_len[0]-20));
1799 xfr->refresh = sldns_read_uint32(d->rr_data[0]+(d->rr_len[0]-16));
1800 xfr->retry = sldns_read_uint32(d->rr_data[0]+(d->rr_len[0]-12));
1801 xfr->expiry = sldns_read_uint32(d->rr_data[0]+(d->rr_len[0]-8));
1966 * workers, so the xfr can just be deleted. */
1972 struct auth_xfer* xfr;
1990 xfr = auth_xfer_find(az, z->name, z->namelen, z->dclass);
1991 if(xfr) {
1992 (void)rbtree_delete(&az->xtree, &xfr->node);
1993 auth_xfer_delete(xfr);
2077 * @param xfr: delete this xfer and its tasks.
2080 auth_xfer_delete(struct auth_xfer* xfr)
2082 if(!xfr) return;
2083 lock_basic_destroy(&xfr->lock);
2084 free(xfr->name);
2085 if(xfr->task_nextprobe) {
2086 comm_timer_delete(xfr->task_nextprobe->timer);
2087 free(xfr->task_nextprobe);
2089 if(xfr->task_probe) {
2090 auth_free_masters(xfr->task_probe->masters);
2091 comm_point_delete(xfr->task_probe->cp);
2092 comm_timer_delete(xfr->task_probe->timer);
2093 free(xfr->task_probe);
2095 if(xfr->task_transfer) {
2096 auth_free_masters(xfr->task_transfer->masters);
2097 comm_point_delete(xfr->task_transfer->cp);
2098 comm_timer_delete(xfr->task_transfer->timer);
2099 if(xfr->task_transfer->chunks_first) {
2100 auth_chunks_delete(xfr->task_transfer);
2102 free(xfr->task_transfer);
2104 auth_free_masters(xfr->allow_notify_list);
2105 free(xfr);
3492 az_xfr_allowed_notify(struct auth_xfer* xfr, struct sockaddr_storage* addr,
3496 for(p=xfr->allow_notify_list; p; p=p->next) {
3507 xfr_serial_means_update(struct auth_xfer* xfr, uint32_t serial)
3509 if(!xfr->have_zone)
3511 if(xfr->zone_expired)
3514 if(compare_serial(xfr->serial, serial) < 0)
3520 /** note notify serial, updates the notify information in the xfr struct */
3522 xfr_note_notify_serial(struct auth_xfer* xfr, int has_serial, uint32_t serial)
3524 if(xfr->notify_received && xfr->notify_has_serial && has_serial) {
3526 if(compare_serial(xfr->notify_serial, serial) < 0)
3527 xfr->notify_serial = serial;
3528 } else if(xfr->notify_received && xfr->notify_has_serial &&
3531 xfr->notify_has_serial = 0;
3532 xfr->notify_serial = 0;
3533 } else if(xfr->notify_received && !xfr->notify_has_serial) {
3538 xfr->notify_received = 1;
3539 xfr->notify_has_serial = has_serial;
3540 xfr->notify_serial = serial;
3544 /** process a notify serial, start new probe or note serial. xfr is locked */
3546 xfr_process_notify(struct auth_xfer* xfr, struct module_env* env,
3551 if(has_serial && !xfr_serial_means_update(xfr, serial)) {
3552 lock_basic_unlock(&xfr->lock);
3556 if(!xfr_start_probe(xfr, env, fromhost)) {
3558 xfr_note_notify_serial(xfr, has_serial, serial);
3559 lock_basic_unlock(&xfr->lock);
3561 /* successful end of start_probe unlocked xfr->lock */
3569 struct auth_xfer* xfr;
3573 xfr = auth_xfer_find(az, nm, nmlen, dclass);
3574 if(!xfr) {
3580 lock_basic_lock(&xfr->lock);
3584 if(!az_xfr_allowed_notify(xfr, addr, addrlen, &fromhost)) {
3585 lock_basic_unlock(&xfr->lock);
3592 xfr_process_notify(xfr, env, has_serial, serial, fromhost);
3599 struct auth_xfer* xfr;
3601 xfr = auth_xfer_find(az, nm, nmlen, dclass);
3602 if(!xfr) {
3606 lock_basic_lock(&xfr->lock);
3609 xfr_process_notify(xfr, env, 0, 0, NULL);
3615 auth_xfer_set_expired(struct auth_xfer* xfr, struct module_env* env,
3620 /* expire xfr */
3621 lock_basic_lock(&xfr->lock);
3622 xfr->zone_expired = expired;
3623 lock_basic_unlock(&xfr->lock);
3627 z = auth_zone_find(env->auth_zones, xfr->name, xfr->namelen,
3628 xfr->dclass);
3731 probe_copy_masters_for_allow_notify(struct auth_xfer* xfr)
3736 for(p = xfr->task_probe->masters; p; p=p->next) {
3749 auth_free_masters(xfr->allow_notify_list);
3750 xfr->allow_notify_list = list;
3755 xfr_transfer_start_lookups(struct auth_xfer* xfr)
3758 xfr->task_transfer->scan_addr = NULL;
3759 xfr_masterlist_free_addrs(xfr->task_transfer->masters);
3762 xfr->task_transfer->lookup_target = xfr->task_transfer->masters;
3763 xfr->task_transfer->lookup_aaaa = 0;
3768 xfr_transfer_move_to_next_lookup(struct auth_xfer* xfr, struct module_env* env)
3770 if(!xfr->task_transfer->lookup_target)
3772 if(!xfr->task_transfer->lookup_aaaa && env->cfg->do_ip6) {
3774 xfr->task_transfer->lookup_aaaa = 1;
3777 xfr->task_transfer->lookup_target =
3778 xfr->task_transfer->lookup_target->next;
3779 xfr->task_transfer->lookup_aaaa = 0;
3780 if(!env->cfg->do_ip4 && xfr->task_transfer->lookup_target!=NULL)
3781 xfr->task_transfer->lookup_aaaa = 1;
3786 xfr_probe_start_lookups(struct auth_xfer* xfr)
3789 xfr->task_probe->scan_addr = NULL;
3790 xfr_masterlist_free_addrs(xfr->task_probe->masters);
3793 xfr->task_probe->lookup_target = xfr->task_probe->masters;
3794 xfr->task_probe->lookup_aaaa = 0;
3799 xfr_probe_move_to_next_lookup(struct auth_xfer* xfr, struct module_env* env)
3801 if(!xfr->task_probe->lookup_target)
3803 if(!xfr->task_probe->lookup_aaaa && env->cfg->do_ip6) {
3805 xfr->task_probe->lookup_aaaa = 1;
3808 xfr->task_probe->lookup_target = xfr->task_probe->lookup_target->next;
3809 xfr->task_probe->lookup_aaaa = 0;
3810 if(!env->cfg->do_ip4 && xfr->task_probe->lookup_target!=NULL)
3811 xfr->task_probe->lookup_aaaa = 1;
3816 xfr_transfer_start_list(struct auth_xfer* xfr, struct auth_master* spec)
3819 xfr->task_transfer->scan_specific = find_master_by_host(
3820 xfr->task_transfer->masters, spec->host);
3821 if(xfr->task_transfer->scan_specific) {
3822 xfr->task_transfer->scan_target = NULL;
3823 xfr->task_transfer->scan_addr = NULL;
3824 if(xfr->task_transfer->scan_specific->list)
3825 xfr->task_transfer->scan_addr =
3826 xfr->task_transfer->scan_specific->list;
3831 xfr->task_transfer->scan_specific = NULL;
3832 xfr->task_transfer->scan_addr = NULL;
3834 xfr->task_transfer->scan_target = xfr->task_transfer->masters;
3835 if(xfr->task_transfer->scan_target && xfr->task_transfer->
3837 xfr->task_transfer->scan_addr =
3838 xfr->task_transfer->scan_target->list;
3843 xfr_probe_start_list(struct auth_xfer* xfr, struct auth_master* spec)
3846 xfr->task_probe->scan_specific = find_master_by_host(
3847 xfr->task_probe->masters, spec->host);
3848 if(xfr->task_probe->scan_specific) {
3849 xfr->task_probe->scan_target = NULL;
3850 xfr->task_probe->scan_addr = NULL;
3851 if(xfr->task_probe->scan_specific->list)
3852 xfr->task_probe->scan_addr =
3853 xfr->task_probe->scan_specific->list;
3858 xfr->task_probe->scan_specific = NULL;
3859 xfr->task_probe->scan_addr = NULL;
3861 xfr->task_probe->scan_target = xfr->task_probe->masters;
3862 if(xfr->task_probe->scan_target && xfr->task_probe->scan_target->list)
3863 xfr->task_probe->scan_addr =
3864 xfr->task_probe->scan_target->list;
3869 xfr_transfer_current_master(struct auth_xfer* xfr)
3871 if(xfr->task_transfer->scan_specific)
3872 return xfr->task_transfer->scan_specific;
3873 return xfr->task_transfer->scan_target;
3878 xfr_probe_current_master(struct auth_xfer* xfr)
3880 if(xfr->task_probe->scan_specific)
3881 return xfr->task_probe->scan_specific;
3882 return xfr->task_probe->scan_target;
3887 xfr_transfer_end_of_list(struct auth_xfer* xfr)
3889 return !xfr->task_transfer->scan_specific &&
3890 !xfr->task_transfer->scan_target;
3895 xfr_probe_end_of_list(struct auth_xfer* xfr)
3897 return !xfr->task_probe->scan_specific && !xfr->task_probe->scan_target;
3902 xfr_transfer_nextmaster(struct auth_xfer* xfr)
3904 if(!xfr->task_transfer->scan_specific &&
3905 !xfr->task_transfer->scan_target)
3907 if(xfr->task_transfer->scan_addr) {
3908 xfr->task_transfer->scan_addr =
3909 xfr->task_transfer->scan_addr->next;
3910 if(xfr->task_transfer->scan_addr)
3913 if(xfr->task_transfer->scan_specific) {
3914 xfr->task_transfer->scan_specific = NULL;
3915 xfr->task_transfer->scan_target = xfr->task_transfer->masters;
3916 if(xfr->task_transfer->scan_target && xfr->task_transfer->
3918 xfr->task_transfer->scan_addr =
3919 xfr->task_transfer->scan_target->list;
3922 if(!xfr->task_transfer->scan_target)
3924 xfr->task_transfer->scan_target = xfr->task_transfer->scan_target->next;
3925 if(xfr->task_transfer->scan_target && xfr->task_transfer->
3927 xfr->task_transfer->scan_addr =
3928 xfr->task_transfer->scan_target->list;
3934 xfr_probe_nextmaster(struct auth_xfer* xfr)
3936 if(!xfr->task_probe->scan_specific && !xfr->task_probe->scan_target)
3938 if(xfr->task_probe->scan_addr) {
3939 xfr->task_probe->scan_addr = xfr->task_probe->scan_addr->next;
3940 if(xfr->task_probe->scan_addr)
3943 if(xfr->task_probe->scan_specific) {
3944 xfr->task_probe->scan_specific = NULL;
3945 xfr->task_probe->scan_target = xfr->task_probe->masters;
3946 if(xfr->task_probe->scan_target && xfr->task_probe->
3948 xfr->task_probe->scan_addr =
3949 xfr->task_probe->scan_target->list;
3952 if(!xfr->task_probe->scan_target)
3954 xfr->task_probe->scan_target = xfr->task_probe->scan_target->next;
3955 if(xfr->task_probe->scan_target && xfr->task_probe->
3957 xfr->task_probe->scan_addr =
3958 xfr->task_probe->scan_target->list;
3962 /** create SOA probe packet for xfr */
3964 xfr_create_soa_probe_packet(struct auth_xfer* xfr, sldns_buffer* buf,
3970 qinfo.qname = xfr->name;
3971 qinfo.qname_len = xfr->namelen;
3973 qinfo.qclass = xfr->dclass;
3978 /** create IXFR/AXFR packet for xfr */
3980 xfr_create_ixfr_packet(struct auth_xfer* xfr, sldns_buffer* buf, uint16_t id,
3986 have_zone = xfr->have_zone;
3987 serial = xfr->serial;
3990 qinfo.qname = xfr->name;
3991 qinfo.qname_len = xfr->namelen;
3992 xfr->task_transfer->got_xfr_serial = 0;
3993 xfr->task_transfer->rr_scan_num = 0;
3994 xfr->task_transfer->incoming_xfr_serial = 0;
3995 xfr->task_transfer->on_ixfr_is_axfr = 0;
3996 xfr->task_transfer->on_ixfr = 1;
3998 if(!have_zone || xfr->task_transfer->ixfr_fail || !master->ixfr) {
4000 xfr->task_transfer->ixfr_fail = 0;
4001 xfr->task_transfer->on_ixfr = 0;
4004 qinfo.qclass = xfr->dclass;
4035 check_packet_ok(sldns_buffer* pkt, uint16_t qtype, struct auth_xfer* xfr,
4045 if(LDNS_ID_WIRE(sldns_buffer_begin(pkt)) != xfr->task_probe->id)
4060 if(sldns_buffer_remaining(pkt) < xfr->namelen)
4062 if(query_dname_compare(sldns_buffer_current(pkt), xfr->name) != 0)
4064 sldns_buffer_skip(pkt, (ssize_t)xfr->namelen);
4071 if(sldns_buffer_read_u16(pkt) != xfr->dclass)
4083 xfr->name) != 0)
4092 if(sldns_buffer_read_u16(pkt) != xfr->dclass)
4313 http_zonefile_syntax_check(struct auth_xfer* xfr, sldns_buffer* buf)
4323 if(xfr->namelen < sizeof(pstate.origin)) {
4324 pstate.origin_len = xfr->namelen;
4325 memmove(pstate.origin, xfr->name, xfr->namelen);
4327 chunk = xfr->task_transfer->chunks_first;
4344 if(sldns_wirerr_get_class(rr, rr_len, dname_len) != xfr->dclass) {
4383 http_parse_add_rr(struct auth_xfer* xfr, struct auth_zone* z,
4397 xfr->task_transfer->master->host,
4398 xfr->task_transfer->master->file,
4419 chunk_rrlist_start(struct auth_xfer* xfr, struct auth_chunk** rr_chunk,
4422 *rr_chunk = xfr->task_transfer->chunks_first;
4590 apply_ixfr(struct auth_xfer* xfr, struct auth_zone* z,
4607 chunk_rrlist_start(xfr, &rr_chunk, &rr_num, &rr_pos);
4638 transfer_serial, xfr->serial)) {
4659 xfr->serial = transfer_serial;
4727 apply_axfr(struct auth_xfer* xfr, struct auth_zone* z,
4748 xfr->have_zone = 0;
4749 xfr->serial = 0;
4754 chunk_rrlist_start(xfr, &rr_chunk, &rr_num, &rr_pos);
4790 xfr->serial = serial;
4791 xfr->have_zone = 1;
4797 apply_http(struct auth_xfer* xfr, struct auth_zone* z,
4808 if(xfr->namelen < sizeof(pstate.origin)) {
4809 pstate.origin_len = xfr->namelen;
4810 memmove(pstate.origin, xfr->name, xfr->namelen);
4815 xfr->task_transfer->master->file,
4816 (int)chunklist_sum(xfr->task_transfer->chunks_first));
4817 if(xfr->task_transfer->chunks_first && verbosity >= VERB_ALGO) {
4819 if(xfr->task_transfer->chunks_first->len+1 > sizeof(preview)) {
4820 memmove(preview, xfr->task_transfer->chunks_first->data,
4824 memmove(preview, xfr->task_transfer->chunks_first->data,
4825 xfr->task_transfer->chunks_first->len);
4826 preview[xfr->task_transfer->chunks_first->len]=0;
4833 if(!http_zonefile_syntax_check(xfr, scratch_buffer)) {
4835 "but got '%s'", xfr->task_transfer->master->host,
4836 xfr->task_transfer->master->file,
4848 xfr->have_zone = 0;
4849 xfr->serial = 0;
4851 chunk = xfr->task_transfer->chunks_first;
4868 if(!http_parse_add_rr(xfr, z, scratch_buffer, &pstate)) {
4870 xfr->task_transfer->master->file,
4881 auth_zone_write_chunks(struct auth_xfer* xfr, const char* fname)
4890 for(p = xfr->task_transfer->chunks_first; p ; p = p->next) {
4903 xfr_write_after_update(struct auth_xfer* xfr, struct module_env* env)
4909 lock_basic_unlock(&xfr->lock);
4914 z = auth_zone_find(env->auth_zones, xfr->name, xfr->namelen,
4915 xfr->dclass);
4918 /* the zone is gone, ignore xfr results */
4919 lock_basic_lock(&xfr->lock);
4923 lock_basic_lock(&xfr->lock);
4950 if(xfr->task_transfer->master->http) {
4952 if(!auth_zone_write_chunks(xfr, tmpfile)) {
4975 xfr_process_chunk_list(struct auth_xfer* xfr, struct module_env* env,
4981 /* release xfr lock, then, while holding az->lock grab both
4982 * z->lock and xfr->lock */
4983 lock_basic_unlock(&xfr->lock);
4985 z = auth_zone_find(env->auth_zones, xfr->name, xfr->namelen,
4986 xfr->dclass);
4989 /* the zone is gone, ignore xfr results */
4990 lock_basic_lock(&xfr->lock);
4994 lock_basic_lock(&xfr->lock);
4998 if(xfr->task_transfer->master->http) {
4999 if(!apply_http(xfr, z, env->scratch_buffer)) {
5002 xfr->task_transfer->master->host);
5005 } else if(xfr->task_transfer->on_ixfr &&
5006 !xfr->task_transfer->on_ixfr_is_axfr) {
5007 if(!apply_ixfr(xfr, z, env->scratch_buffer)) {
5009 verbose(VERB_ALGO, "xfr from %s: could not store IXFR"
5010 " data", xfr->task_transfer->master->host);
5015 if(!apply_axfr(xfr, z, env->scratch_buffer)) {
5017 verbose(VERB_ALGO, "xfr from %s: could not store AXFR"
5018 " data", xfr->task_transfer->master->host);
5022 xfr->zone_expired = 0;
5024 if(!xfr_find_soa(z, xfr)) {
5026 verbose(VERB_ALGO, "xfr from %s: no SOA in zone after update"
5027 " (or malformed RR)", xfr->task_transfer->master->host);
5030 if(xfr->have_zone)
5031 xfr->lease_time = *env->now;
5039 if(verbosity >= VERB_QUERY && xfr->have_zone) {
5041 dname_str(xfr->name, zname);
5043 (unsigned)xfr->serial);
5046 xfr_write_after_update(xfr, env);
5050 /** disown task_transfer. caller must hold xfr.lock */
5052 xfr_transfer_disown(struct auth_xfer* xfr)
5055 comm_timer_delete(xfr->task_transfer->timer);
5056 xfr->task_transfer->timer = NULL;
5058 comm_point_delete(xfr->task_transfer->cp);
5059 xfr->task_transfer->cp = NULL;
5061 xfr->task_transfer->worker = NULL;
5062 xfr->task_transfer->env = NULL;
5067 xfr_transfer_lookup_host(struct auth_xfer* xfr, struct module_env* env)
5071 struct auth_master* master = xfr->task_transfer->lookup_target;
5095 qinfo.qclass = xfr->dclass;
5097 if(xfr->task_transfer->lookup_aaaa)
5103 dname_str(xfr->name, buf2);
5118 /* unlock xfr during mesh_new_callback() because the callback can be
5120 lock_basic_unlock(&xfr->lock);
5122 &auth_xfer_transfer_lookup_callback, xfr)) {
5123 lock_basic_lock(&xfr->lock);
5127 lock_basic_lock(&xfr->lock);
5134 xfr_transfer_init_fetch(struct auth_xfer* xfr, struct module_env* env)
5138 struct auth_master* master = xfr->task_transfer->master;
5146 if(xfr->task_transfer->scan_addr) {
5147 addrlen = xfr->task_transfer->scan_addr->addrlen;
5148 memmove(&addr, &xfr->task_transfer->scan_addr->addr, addrlen);
5155 dname_str(xfr->name, zname);
5163 if(xfr->task_transfer->cp) {
5164 comm_point_delete(xfr->task_transfer->cp);
5165 xfr->task_transfer->cp = NULL;
5167 if(!xfr->task_transfer->timer) {
5168 xfr->task_transfer->timer = comm_timer_create(env->worker_base,
5169 auth_xfer_transfer_timer_callback, xfr);
5170 if(!xfr->task_transfer->timer) {
5185 xfr->task_transfer->on_ixfr = 0;
5188 xfr->task_transfer->cp = outnet_comm_point_for_http(
5189 env->outnet, auth_xfer_transfer_http_callback, xfr,
5192 if(!xfr->task_transfer->cp) {
5194 dname_str(xfr->name, zname);
5200 comm_timer_set(xfr->task_transfer->timer, &t);
5203 dname_str(xfr->name, zname);
5213 xfr->task_transfer->id = (uint16_t)(ub_random(env->rnd)&0xffff);
5214 xfr_create_ixfr_packet(xfr, env->scratch_buffer,
5215 xfr->task_transfer->id, master);
5218 xfr->task_transfer->cp = outnet_comm_point_for_tcp(env->outnet,
5219 auth_xfer_transfer_tcp_callback, xfr, &addr, addrlen,
5222 if(!xfr->task_transfer->cp) {
5224 dname_str(xfr->name, zname);
5227 "xfr %s to %s", zname, as);
5230 comm_timer_set(xfr->task_transfer->timer, &t);
5233 dname_str(xfr->name, zname);
5236 (xfr->task_transfer->on_ixfr?"IXFR":"AXFR"), as);
5243 xfr_transfer_nexttarget_or_end(struct auth_xfer* xfr, struct module_env* env)
5245 log_assert(xfr->task_transfer->worker == env->worker);
5248 while(xfr->task_transfer->lookup_target) {
5249 if(xfr_transfer_lookup_host(xfr, env)) {
5257 dname_str(xfr->name, zname);
5260 lock_basic_unlock(&xfr->lock);
5263 xfr_transfer_move_to_next_lookup(xfr, env);
5268 while(!xfr_transfer_end_of_list(xfr)) {
5269 xfr->task_transfer->master = xfr_transfer_current_master(xfr);
5270 if(xfr_transfer_init_fetch(xfr, env)) {
5272 lock_basic_unlock(&xfr->lock);
5276 xfr_transfer_nextmaster(xfr);
5280 dname_str(xfr->name, zname);
5286 xfr_transfer_disown(xfr);
5289 if(xfr->task_nextprobe->worker == NULL)
5290 xfr_set_timeout(xfr, env, 1, 0);
5291 lock_basic_unlock(&xfr->lock);
5352 struct auth_xfer* xfr = (struct auth_xfer*)arg;
5354 log_assert(xfr->task_transfer);
5355 lock_basic_lock(&xfr->lock);
5356 env = xfr->task_transfer->env;
5358 lock_basic_unlock(&xfr->lock);
5368 if(xfr->task_transfer->lookup_aaaa)
5378 xfr_master_add_addrs(xfr->task_transfer->
5383 dname_str(xfr->name, zname);
5384 verbose(VERB_ALGO, "auth zone %s host %s type %s transfer lookup has nodata", zname, xfr->task_transfer->lookup_target->host, (xfr->task_transfer->lookup_aaaa?"AAAA":"A"));
5390 dname_str(xfr->name, zname);
5391 verbose(VERB_ALGO, "auth zone %s host %s type %s transfer lookup has no answer", zname, xfr->task_transfer->lookup_target->host, (xfr->task_transfer->lookup_aaaa?"AAAA":"A"));
5398 dname_str(xfr->name, zname);
5399 verbose(VERB_ALGO, "auth zone %s host %s type %s transfer lookup failed", zname, xfr->task_transfer->lookup_target->host, (xfr->task_transfer->lookup_aaaa?"AAAA":"A"));
5402 if(xfr->task_transfer->lookup_target->list &&
5403 xfr->task_transfer->lookup_target == xfr_transfer_current_master(xfr))
5404 xfr->task_transfer->scan_addr = xfr->task_transfer->lookup_target->list;
5408 xfr_transfer_move_to_next_lookup(xfr, env);
5409 xfr_transfer_nexttarget_or_end(xfr, env);
5420 check_xfer_packet(sldns_buffer* pkt, struct auth_xfer* xfr,
5426 verbose(VERB_ALGO, "xfr to %s failed, packet too small",
5427 xfr->task_transfer->master->host);
5431 verbose(VERB_ALGO, "xfr to %s failed, packet has no QR flag",
5432 xfr->task_transfer->master->host);
5436 verbose(VERB_ALGO, "xfr to %s failed, packet has TC flag",
5437 xfr->task_transfer->master->host);
5441 if(LDNS_ID_WIRE(wire) != xfr->task_transfer->id) {
5442 verbose(VERB_ALGO, "xfr to %s failed, packet wrong ID",
5443 xfr->task_transfer->master->host);
5451 if(xfr->task_transfer->on_ixfr) {
5456 verbose(VERB_ALGO, "xfr to %s, fallback "
5458 xfr->task_transfer->master->host,
5460 xfr->task_transfer->ixfr_fail = 1;
5465 verbose(VERB_ALGO, "xfr to %s failed, packet with rcode %s",
5466 xfr->task_transfer->master->host, rcode);
5470 verbose(VERB_ALGO, "xfr to %s failed, packet with bad opcode",
5471 xfr->task_transfer->master->host);
5475 verbose(VERB_ALGO, "xfr to %s failed, packet has qdcount %d",
5476 xfr->task_transfer->master->host,
5487 verbose(VERB_ALGO, "xfr to %s failed, packet with "
5489 xfr->task_transfer->master->host);
5493 xfr->name) != 0) {
5494 verbose(VERB_ALGO, "xfr to %s failed, packet with "
5496 xfr->task_transfer->master->host);
5500 verbose(VERB_ALGO, "xfr to %s failed, packet with "
5502 xfr->task_transfer->master->host);
5507 if(qclass != xfr->dclass) {
5508 verbose(VERB_ALGO, "xfr to %s failed, packet with "
5510 xfr->task_transfer->master->host);
5513 if(xfr->task_transfer->on_ixfr) {
5515 verbose(VERB_ALGO, "xfr to %s failed, packet "
5517 xfr->task_transfer->master->host);
5522 verbose(VERB_ALGO, "xfr to %s failed, packet "
5524 xfr->task_transfer->master->host);
5537 verbose(VERB_ALGO, "xfr to %s failed, packet with "
5539 xfr->task_transfer->master->host);
5543 verbose(VERB_ALGO, "xfr to %s failed, packet with "
5545 xfr->task_transfer->master->host);
5553 verbose(VERB_ALGO, "xfr to %s failed, packet with "
5555 xfr->task_transfer->master->host);
5561 if(xfr->task_transfer->rr_scan_num == 0 &&
5563 verbose(VERB_ALGO, "xfr to %s failed, packet with "
5565 xfr->task_transfer->master->host);
5568 if(xfr->task_transfer->rr_scan_num == 1 &&
5572 xfr->task_transfer->on_ixfr_is_axfr = 1;
5577 verbose(VERB_ALGO, "xfr to %s failed, packet "
5579 xfr->task_transfer->master->host);
5583 xfr->name) != 0) {
5584 verbose(VERB_ALGO, "xfr to %s failed, packet "
5586 xfr->task_transfer->master->host);
5595 if(xfr->task_transfer->on_ixfr &&
5596 xfr->task_transfer->rr_scan_num == 0 &&
5598 verbose(VERB_ALGO, "xfr to %s ended, "
5601 xfr->task_transfer->master->host,
5603 xfr->task_transfer->ixfr_fail = 1;
5609 if(xfr->task_transfer->got_xfr_serial == 0) {
5610 xfr->task_transfer->got_xfr_serial = 1;
5611 xfr->task_transfer->incoming_xfr_serial =
5613 verbose(VERB_ALGO, "xfr %s: contains "
5615 xfr->task_transfer->master->host,
5618 } else if(!xfr->task_transfer->on_ixfr ||
5619 xfr->task_transfer->on_ixfr_is_axfr) {
5623 verbose(VERB_ALGO, "xfr %s: last AXFR packet",
5624 xfr->task_transfer->master->host);
5626 } else if(xfr->task_transfer->incoming_xfr_serial ==
5627 serial && xfr->task_transfer->got_xfr_serial
5629 xfr->task_transfer->got_xfr_serial++;
5632 } else if(xfr->task_transfer->incoming_xfr_serial ==
5633 serial && xfr->task_transfer->got_xfr_serial
5635 verbose(VERB_ALGO, "xfr %s: last IXFR packet",
5636 xfr->task_transfer->master->host);
5642 xfr->task_transfer->rr_scan_num++;
5653 verbose(VERB_ALGO, "xfr to %s failed, packet with "
5655 xfr->task_transfer->master->host);
5659 verbose(VERB_ALGO, "xfr to %s failed, packet with "
5661 xfr->task_transfer->master->host);
5669 verbose(VERB_ALGO, "xfr to %s failed, packet with "
5671 xfr->task_transfer->master->host);
5682 verbose(VERB_ALGO, "xfr to %s failed, packet with "
5684 xfr->task_transfer->master->host);
5688 verbose(VERB_ALGO, "xfr to %s failed, packet with "
5690 xfr->task_transfer->master->host);
5698 verbose(VERB_ALGO, "xfr to %s failed, packet with "
5700 xfr->task_transfer->master->host);
5712 xfer_link_data(sldns_buffer* pkt, struct auth_xfer* xfr)
5727 if(!xfr->task_transfer->chunks_first)
5728 xfr->task_transfer->chunks_first = e;
5729 if(xfr->task_transfer->chunks_last)
5730 xfr->task_transfer->chunks_last->next = e;
5731 xfr->task_transfer->chunks_last = e;
5738 process_list_end_transfer(struct auth_xfer* xfr, struct module_env* env)
5741 if(xfr_process_chunk_list(xfr, env, &ixfr_fail)) {
5743 auth_chunks_delete(xfr->task_transfer);
5746 xfr_transfer_disown(xfr);
5748 if(xfr->notify_received && (!xfr->notify_has_serial ||
5749 (xfr->notify_has_serial &&
5750 xfr_serial_means_update(xfr, xfr->notify_serial)))) {
5751 uint32_t sr = xfr->notify_serial;
5752 int has_sr = xfr->notify_has_serial;
5755 xfr->notify_received = 0;
5756 xfr->notify_has_serial = 0;
5757 xfr->notify_serial = 0;
5758 if(!xfr_start_probe(xfr, env, NULL)) {
5761 * while xfr still locked */
5762 xfr->notify_received = 1;
5763 xfr->notify_has_serial = has_sr;
5764 xfr->notify_serial = sr;
5765 lock_basic_unlock(&xfr->lock);
5770 if(xfr->task_nextprobe->worker == NULL)
5771 xfr_set_timeout(xfr, env, 0, 0);
5773 lock_basic_unlock(&xfr->lock);
5778 auth_chunks_delete(xfr->task_transfer);
5780 xfr->task_transfer->ixfr_fail = 1;
5782 xfr_transfer_nextmaster(xfr);
5784 xfr_transfer_nexttarget_or_end(xfr, env);
5791 struct auth_xfer* xfr = (struct auth_xfer*)arg;
5794 log_assert(xfr->task_transfer);
5795 lock_basic_lock(&xfr->lock);
5796 env = xfr->task_transfer->env;
5798 lock_basic_unlock(&xfr->lock);
5802 verbose(VERB_ALGO, "xfr stopped, connection timeout to %s",
5803 xfr->task_transfer->master->host);
5806 if(xfr->task_transfer->on_ixfr) {
5807 xfr->task_transfer->ixfr_possible_timeout_count++;
5808 if(xfr->task_transfer->ixfr_possible_timeout_count >=
5810 verbose(VERB_ALGO, "xfr to %s, fallback "
5812 xfr->task_transfer->master->host);
5813 xfr->task_transfer->ixfr_fail = 1;
5819 auth_chunks_delete(xfr->task_transfer);
5820 comm_point_delete(xfr->task_transfer->cp);
5821 xfr->task_transfer->cp = NULL;
5823 xfr_transfer_nextmaster(xfr);
5824 xfr_transfer_nexttarget_or_end(xfr, env);
5832 struct auth_xfer* xfr = (struct auth_xfer*)arg;
5836 log_assert(xfr->task_transfer);
5837 lock_basic_lock(&xfr->lock);
5838 env = xfr->task_transfer->env;
5840 lock_basic_unlock(&xfr->lock);
5844 comm_timer_disable(xfr->task_transfer->timer);
5850 verbose(VERB_ALGO, "xfr stopped, connection lost to %s",
5851 xfr->task_transfer->master->host);
5854 if(xfr->task_transfer->on_ixfr) {
5855 xfr->task_transfer->ixfr_possible_timeout_count++;
5856 if(xfr->task_transfer->ixfr_possible_timeout_count >=
5858 verbose(VERB_ALGO, "xfr to %s, fallback "
5860 xfr->task_transfer->master->host);
5861 xfr->task_transfer->ixfr_fail = 1;
5868 auth_chunks_delete(xfr->task_transfer);
5869 comm_point_delete(xfr->task_transfer->cp);
5870 xfr->task_transfer->cp = NULL;
5872 xfr_transfer_nextmaster(xfr);
5873 xfr_transfer_nexttarget_or_end(xfr, env);
5877 if(xfr->task_transfer->on_ixfr)
5878 xfr->task_transfer->ixfr_possible_timeout_count = 0;
5883 if(!check_xfer_packet(c->buffer, xfr, &gonextonfail, &transferdone)) {
5888 if(!xfer_link_data(c->buffer, xfr)) {
5889 verbose(VERB_ALGO, "xfr stopped to %s, malloc failed",
5890 xfr->task_transfer->master->host);
5895 comm_point_delete(xfr->task_transfer->cp);
5896 xfr->task_transfer->cp = NULL;
5897 process_list_end_transfer(xfr, env);
5903 lock_basic_unlock(&xfr->lock);
5915 struct auth_xfer* xfr = (struct auth_xfer*)arg;
5917 log_assert(xfr->task_transfer);
5918 lock_basic_lock(&xfr->lock);
5919 env = xfr->task_transfer->env;
5921 lock_basic_unlock(&xfr->lock);
5926 comm_timer_disable(xfr->task_transfer->timer);
5933 xfr->task_transfer->master->host);
5936 auth_chunks_delete(xfr->task_transfer);
5939 comm_point_delete(xfr->task_transfer->cp);
5940 xfr->task_transfer->cp = NULL;
5941 xfr_transfer_nextmaster(xfr);
5942 xfr_transfer_nexttarget_or_end(xfr, env);
5951 if(!xfer_link_data(c->buffer, xfr)) {
5953 xfr->task_transfer->master->host);
5961 comm_point_delete(xfr->task_transfer->cp);
5962 xfr->task_transfer->cp = NULL;
5963 process_list_end_transfer(xfr, env);
5969 lock_basic_unlock(&xfr->lock);
5977 /** start transfer task by this worker , xfr is locked. */
5979 xfr_start_transfer(struct auth_xfer* xfr, struct module_env* env,
5982 log_assert(xfr->task_transfer != NULL);
5983 log_assert(xfr->task_transfer->worker == NULL);
5984 log_assert(xfr->task_transfer->chunks_first == NULL);
5985 log_assert(xfr->task_transfer->chunks_last == NULL);
5986 xfr->task_transfer->worker = env->worker;
5987 xfr->task_transfer->env = env;
5991 xfr_transfer_start_list(xfr, master);
5993 xfr_transfer_start_lookups(xfr);
5996 xfr_transfer_nexttarget_or_end(xfr, env);
5999 /** disown task_probe. caller must hold xfr.lock */
6001 xfr_probe_disown(struct auth_xfer* xfr)
6004 comm_timer_delete(xfr->task_probe->timer);
6005 xfr->task_probe->timer = NULL;
6007 comm_point_delete(xfr->task_probe->cp);
6008 xfr->task_probe->cp = NULL;
6010 xfr->task_probe->worker = NULL;
6011 xfr->task_probe->env = NULL;
6016 xfr_probe_send_probe(struct auth_xfer* xfr, struct module_env* env,
6023 struct auth_master* master = xfr_probe_current_master(xfr);
6031 if(xfr->task_probe->scan_addr) {
6032 addrlen = xfr->task_probe->scan_addr->addrlen;
6033 memmove(&addr, &xfr->task_probe->scan_addr->addr, addrlen);
6040 dname_str(xfr->name, zname);
6063 xfr->task_probe->id = (uint16_t)(ub_random(env->rnd)&0xffff);
6064 xfr_create_soa_probe_packet(xfr, env->scratch_buffer,
6065 xfr->task_probe->id);
6067 if(xfr->task_probe->cp &&
6068 ((xfr->task_probe->cp_is_ip6 && !addr_is_ip6(&addr, addrlen)) ||
6069 (!xfr->task_probe->cp_is_ip6 && addr_is_ip6(&addr, addrlen)))
6071 comm_point_delete(xfr->task_probe->cp);
6072 xfr->task_probe->cp = NULL;
6074 if(!xfr->task_probe->cp) {
6076 xfr->task_probe->cp_is_ip6 = 1;
6077 else xfr->task_probe->cp_is_ip6 = 0;
6078 xfr->task_probe->cp = outnet_comm_point_for_udp(env->outnet,
6079 auth_xfer_probe_udp_callback, xfr, &addr, addrlen);
6080 if(!xfr->task_probe->cp) {
6082 dname_str(xfr->name, zname);
6089 if(!xfr->task_probe->timer) {
6090 xfr->task_probe->timer = comm_timer_create(env->worker_base,
6091 auth_xfer_probe_timer_callback, xfr);
6092 if(!xfr->task_probe->timer) {
6099 if(!comm_point_send_udp_msg(xfr->task_probe->cp, env->scratch_buffer,
6102 dname_str(xfr->name, zname);
6110 dname_str(xfr->name, zname);
6115 xfr->task_probe->timeout = timeout;
6120 comm_timer_set(xfr->task_probe->timer, &t);
6129 struct auth_xfer* xfr = (struct auth_xfer*)arg;
6131 log_assert(xfr->task_probe);
6132 lock_basic_lock(&xfr->lock);
6133 env = xfr->task_probe->env;
6135 lock_basic_unlock(&xfr->lock);
6141 dname_str(xfr->name, zname);
6144 if(xfr->task_probe->timeout <= AUTH_PROBE_TIMEOUT_STOP) {
6146 if(xfr_probe_send_probe(xfr, env, xfr->task_probe->timeout*2)) {
6147 lock_basic_unlock(&xfr->lock);
6152 comm_point_delete(xfr->task_probe->cp);
6153 xfr->task_probe->cp = NULL;
6156 xfr_probe_nextmaster(xfr);
6157 xfr_probe_send_or_end(xfr, env);
6165 struct auth_xfer* xfr = (struct auth_xfer*)arg;
6167 log_assert(xfr->task_probe);
6168 lock_basic_lock(&xfr->lock);
6169 env = xfr->task_probe->env;
6171 lock_basic_unlock(&xfr->lock);
6179 comm_timer_disable(xfr->task_probe->timer);
6184 if(check_packet_ok(c->buffer, LDNS_RR_TYPE_SOA, xfr,
6189 dname_str(xfr->name, buf);
6195 if(xfr_serial_means_update(xfr, serial)) {
6198 if(xfr->task_transfer->worker == NULL) {
6200 xfr_probe_current_master(xfr);
6204 if(xfr->task_transfer->masters &&
6205 xfr->task_transfer->masters->http)
6207 xfr_probe_disown(xfr);
6208 xfr_start_transfer(xfr, env, master);
6213 xfr_probe_disown(xfr);
6214 lock_basic_unlock(&xfr->lock);
6223 xfr->task_probe->have_new_lease = 1;
6228 dname_str(xfr->name, buf);
6235 dname_str(xfr->name, buf);
6242 comm_point_delete(xfr->task_probe->cp);
6243 xfr->task_probe->cp = NULL;
6247 xfr_probe_nextmaster(xfr);
6248 xfr_probe_send_or_end(xfr, env);
6254 xfr_probe_lookup_host(struct auth_xfer* xfr, struct module_env* env)
6258 struct auth_master* master = xfr->task_probe->lookup_target;
6284 qinfo.qclass = xfr->dclass;
6286 if(xfr->task_probe->lookup_aaaa)
6292 dname_str(xfr->name, buf2);
6307 /* unlock xfr during mesh_new_callback() because the callback can be
6309 lock_basic_unlock(&xfr->lock);
6311 &auth_xfer_probe_lookup_callback, xfr)) {
6312 lock_basic_lock(&xfr->lock);
6316 lock_basic_lock(&xfr->lock);
6322 xfr_probe_send_or_end(struct auth_xfer* xfr, struct module_env* env)
6325 while(xfr->task_probe->lookup_target) {
6326 if(xfr_probe_lookup_host(xfr, env)) {
6334 dname_str(xfr->name, zname);
6337 lock_basic_unlock(&xfr->lock);
6340 xfr_probe_move_to_next_lookup(xfr, env);
6344 probe_copy_masters_for_allow_notify(xfr);
6347 dname_str(xfr->name, zname);
6350 if(xfr->task_probe->only_lookup) {
6352 xfr->task_probe->only_lookup = 0;
6355 dname_str(xfr->name, zname);
6358 xfr_probe_disown(xfr);
6359 if(xfr->task_nextprobe->worker == NULL)
6360 xfr_set_timeout(xfr, env, 0, 0);
6361 lock_basic_unlock(&xfr->lock);
6366 while(!xfr_probe_end_of_list(xfr)) {
6367 if(xfr_probe_send_probe(xfr, env, AUTH_PROBE_TIMEOUT)) {
6369 lock_basic_unlock(&xfr->lock);
6373 xfr_probe_nextmaster(xfr);
6377 if(xfr->task_probe->have_new_lease) {
6381 dname_str(xfr->name, zname);
6384 xfr_probe_disown(xfr);
6385 if(xfr->have_zone)
6386 xfr->lease_time = *env->now;
6387 if(xfr->task_nextprobe->worker == NULL)
6388 xfr_set_timeout(xfr, env, 0, 0);
6392 dname_str(xfr->name, zname);
6397 xfr_probe_disown(xfr);
6399 if(xfr->task_nextprobe->worker == NULL)
6400 xfr_set_timeout(xfr, env, 1, 0);
6403 lock_basic_unlock(&xfr->lock);
6411 struct auth_xfer* xfr = (struct auth_xfer*)arg;
6413 log_assert(xfr->task_probe);
6414 lock_basic_lock(&xfr->lock);
6415 env = xfr->task_probe->env;
6417 lock_basic_unlock(&xfr->lock);
6427 if(xfr->task_probe->lookup_aaaa)
6437 xfr_master_add_addrs(xfr->task_probe->
6442 dname_str(xfr->name, zname);
6443 verbose(VERB_ALGO, "auth zone %s host %s type %s probe lookup has nodata", zname, xfr->task_probe->lookup_target->host, (xfr->task_probe->lookup_aaaa?"AAAA":"A"));
6449 dname_str(xfr->name, zname);
6450 verbose(VERB_ALGO, "auth zone %s host %s type %s probe lookup has no address", zname, xfr->task_probe->lookup_target->host, (xfr->task_probe->lookup_aaaa?"AAAA":"A"));
6457 dname_str(xfr->name, zname);
6458 verbose(VERB_ALGO, "auth zone %s host %s type %s probe lookup failed", zname, xfr->task_probe->lookup_target->host, (xfr->task_probe->lookup_aaaa?"AAAA":"A"));
6461 if(xfr->task_probe->lookup_target->list &&
6462 xfr->task_probe->lookup_target == xfr_probe_current_master(xfr))
6463 xfr->task_probe->scan_addr = xfr->task_probe->lookup_target->list;
6467 xfr_probe_move_to_next_lookup(xfr, env);
6468 xfr_probe_send_or_end(xfr, env);
6471 /** disown task_nextprobe. caller must hold xfr.lock */
6473 xfr_nextprobe_disown(struct auth_xfer* xfr)
6477 comm_timer_delete(xfr->task_nextprobe->timer);
6478 xfr->task_nextprobe->timer = NULL;
6479 xfr->task_nextprobe->next_probe = 0;
6481 xfr->task_nextprobe->worker = NULL;
6482 xfr->task_nextprobe->env = NULL;
6489 struct auth_xfer* xfr = (struct auth_xfer*)arg;
6491 log_assert(xfr->task_nextprobe);
6492 lock_basic_lock(&xfr->lock);
6493 env = xfr->task_nextprobe->env;
6495 lock_basic_unlock(&xfr->lock);
6500 if(xfr->have_zone && !xfr->zone_expired &&
6501 *env->now >= xfr->lease_time + xfr->expiry) {
6502 lock_basic_unlock(&xfr->lock);
6503 auth_xfer_set_expired(xfr, env, 1);
6504 lock_basic_lock(&xfr->lock);
6507 xfr_nextprobe_disown(xfr);
6509 if(!xfr_start_probe(xfr, env, NULL)) {
6511 lock_basic_unlock(&xfr->lock);
6531 xfr_start_probe(struct auth_xfer* xfr, struct module_env* env,
6536 if(xfr->task_probe->worker == NULL) {
6537 if(!have_probe_targets(xfr->task_probe->masters) &&
6538 !(xfr->task_probe->only_lookup &&
6539 xfr->task_probe->masters != NULL)) {
6542 if(xfr->task_transfer->worker == NULL) {
6543 xfr_start_transfer(xfr, env, spec);
6551 xfr->task_probe->worker = env->worker;
6552 xfr->task_probe->env = env;
6553 xfr->task_probe->cp = NULL;
6557 xfr->task_probe->have_new_lease = 0;
6561 xfr_probe_start_list(xfr, spec);
6563 xfr_probe_start_lookups(xfr);
6565 xfr_probe_send_or_end(xfr, env);
6573 * @param xfr: task structure
6579 xfr_set_timeout(struct auth_xfer* xfr, struct module_env* env,
6583 log_assert(xfr->task_nextprobe != NULL);
6584 log_assert(xfr->task_nextprobe->worker == NULL ||
6585 xfr->task_nextprobe->worker == env->worker);
6589 xfr->task_nextprobe->next_probe = *env->now;
6590 if(xfr->lease_time && !failure)
6591 xfr->task_nextprobe->next_probe = xfr->lease_time;
6594 xfr->task_nextprobe->backoff = 0;
6596 if(xfr->task_nextprobe->backoff == 0)
6597 xfr->task_nextprobe->backoff = 3;
6598 else xfr->task_nextprobe->backoff *= 2;
6599 if(xfr->task_nextprobe->backoff > AUTH_TRANSFER_MAX_BACKOFF)
6600 xfr->task_nextprobe->backoff =
6604 if(xfr->have_zone) {
6605 time_t wait = xfr->refresh;
6606 if(failure) wait = xfr->retry;
6607 if(xfr->expiry < wait)
6608 xfr->task_nextprobe->next_probe += xfr->expiry;
6609 else xfr->task_nextprobe->next_probe += wait;
6611 xfr->task_nextprobe->next_probe +=
6612 xfr->task_nextprobe->backoff;
6614 if(xfr->lease_time && xfr->lease_time+xfr->expiry <
6615 xfr->task_nextprobe->next_probe &&
6616 xfr->lease_time+xfr->expiry > *env->now)
6617 xfr->task_nextprobe->next_probe =
6618 xfr->lease_time+xfr->expiry;
6620 xfr->task_nextprobe->next_probe +=
6621 xfr->task_nextprobe->backoff;
6624 if(!xfr->task_nextprobe->timer) {
6625 xfr->task_nextprobe->timer = comm_timer_create(
6626 env->worker_base, auth_xfer_timer, xfr);
6627 if(!xfr->task_nextprobe->timer) {
6631 dname_str(xfr->name, zname);
6637 xfr->task_nextprobe->worker = env->worker;
6638 xfr->task_nextprobe->env = env;
6639 if(*(xfr->task_nextprobe->env->now) <= xfr->task_nextprobe->next_probe)
6640 tv.tv_sec = xfr->task_nextprobe->next_probe -
6641 *(xfr->task_nextprobe->env->now);
6643 if(tv.tv_sec != 0 && lookup_only && xfr->task_probe->masters) {
6647 if(xfr->task_probe->worker == NULL)
6648 xfr->task_probe->only_lookup = 1;
6652 dname_str(xfr->name, zname);
6657 comm_timer_set(xfr->task_nextprobe->timer, &tv);
6709 struct auth_xfer* xfr;
6710 xfr = (struct auth_xfer*)calloc(1, sizeof(*xfr));
6711 if(!xfr) return NULL;
6712 xfr->name = memdup(z->name, z->namelen);
6713 if(!xfr->name) {
6714 free(xfr);
6717 xfr->node.key = xfr;
6718 xfr->namelen = z->namelen;
6719 xfr->namelabs = z->namelabs;
6720 xfr->dclass = z->dclass;
6722 xfr->task_nextprobe = (struct auth_nextprobe*)calloc(1,
6724 if(!xfr->task_nextprobe) {
6725 free(xfr->name);
6726 free(xfr);
6729 xfr->task_probe = (struct auth_probe*)calloc(1,
6731 if(!xfr->task_probe) {
6732 free(xfr->task_nextprobe);
6733 free(xfr->name);
6734 free(xfr);
6737 xfr->task_transfer = (struct auth_transfer*)calloc(1,
6739 if(!xfr->task_transfer) {
6740 free(xfr->task_probe);
6741 free(xfr->task_nextprobe);
6742 free(xfr->name);
6743 free(xfr);
6747 lock_basic_init(&xfr->lock);
6748 lock_protect(&xfr->lock, &xfr->name, sizeof(xfr->name));
6749 lock_protect(&xfr->lock, &xfr->namelen, sizeof(xfr->namelen));
6750 lock_protect(&xfr->lock, xfr->name, xfr->namelen);
6751 lock_protect(&xfr->lock, &xfr->namelabs, sizeof(xfr->namelabs));
6752 lock_protect(&xfr->lock, &xfr->dclass, sizeof(xfr->dclass));
6753 lock_protect(&xfr->lock, &xfr->notify_received, sizeof(xfr->notify_received));
6754 lock_protect(&xfr->lock, &xfr->notify_serial, sizeof(xfr->notify_serial));
6755 lock_protect(&xfr->lock, &xfr->zone_expired, sizeof(xfr->zone_expired));
6756 lock_protect(&xfr->lock, &xfr->have_zone, sizeof(xfr->have_zone));
6757 lock_protect(&xfr->lock, &xfr->serial, sizeof(xfr->serial));
6758 lock_protect(&xfr->lock, &xfr->retry, sizeof(xfr->retry));
6759 lock_protect(&xfr->lock, &xfr->refresh, sizeof(xfr->refresh));
6760 lock_protect(&xfr->lock, &xfr->expiry, sizeof(xfr->expiry));
6761 lock_protect(&xfr->lock, &xfr->lease_time, sizeof(xfr->lease_time));
6762 lock_protect(&xfr->lock, &xfr->task_nextprobe->worker,
6763 sizeof(xfr->task_nextprobe->worker));
6764 lock_protect(&xfr->lock, &xfr->task_probe->worker,
6765 sizeof(xfr->task_probe->worker));
6766 lock_protect(&xfr->lock, &xfr->task_transfer->worker,
6767 sizeof(xfr->task_transfer->worker));
6768 lock_basic_lock(&xfr->lock);
6769 return xfr;
6780 struct auth_xfer* xfr;
6783 xfr = auth_xfer_new(z);
6784 if(!xfr) {
6789 (void)rbtree_insert(&az->xtree, &xfr->node);
6790 return xfr;