Lines Matching refs:soa
2 * xfrd.c - XFR (transfer) Daemon source file. Coordinates SOA updates.
75 /* handle incoming notification message. soa can be NULL. true if transfer needed. */
77 xfrd_soa_type* soa);
79 /* call with buffer just after the soa dname. returns 0 on error. */
80 static int xfrd_parse_soa_info(buffer_type* packet, xfrd_soa_type* soa);
640 "\'%s\': invalid SOA resource record",
695 xfrd_soa_type soa;
696 xfrd_soa_type* soa_ptr = &soa;
725 /* read the soa info */
726 memset(&soa, 0, sizeof(soa));
728 soa.type = htons(TYPE_SOA);
729 soa.klass = htons(CLASS_IN);
730 memmove(&soa.ttl, p, sizeof(uint32_t));
732 memmove(soa.prim_ns, p, sizeof(uint8_t));
734 memmove(soa.prim_ns+1, p, soa.prim_ns[0]);
735 p += soa.prim_ns[0];
736 memmove(soa.email, p, sizeof(uint8_t));
738 memmove(soa.email+1, p, soa.email[0]);
739 p += soa.email[0];
740 memmove(&soa.serial, p, sizeof(uint32_t));
742 memmove(&soa.refresh, p, sizeof(uint32_t));
744 memmove(&soa.retry, p, sizeof(uint32_t));
746 memmove(&soa.expire, p, sizeof(uint32_t));
748 memmove(&soa.minimum, p, sizeof(uint32_t));
752 (unsigned)ntohl(soa.serial)));
878 /* "rollback" on-disk soa information */
1377 xfrd_copy_soa(xfrd_soa_type* soa, rr_type* rr)
1394 soa->type = htons(rr->type);
1395 soa->klass = htons(rr->klass);
1396 soa->ttl = htonl(rr->ttl);
1399 soa->prim_ns[0] = rr_ns_len;
1400 memcpy(soa->prim_ns+1, rr_ns_wire, rr_ns_len);
1401 soa->email[0] = rr_em_len;
1402 memcpy(soa->email+1, rr_em_wire, rr_em_len);
1406 memcpy(&soa->serial, p, sizeof(uint32_t));
1407 memcpy(&soa->refresh, p+4, sizeof(uint32_t));
1408 memcpy(&soa->retry, p+8, sizeof(uint32_t));
1409 memcpy(&soa->expire, p+12, sizeof(uint32_t));
1410 memcpy(&soa->minimum, p+16, sizeof(uint32_t));
1413 (unsigned)ntohl(soa->serial), (unsigned)ntohl(soa->refresh),
1414 (unsigned)ntohl(soa->retry), (unsigned)ntohl(soa->expire)));
1489 xfrd_soa_type* soa, time_t acquired)
1492 if(soa == NULL) {
1500 if(zone->soa_nsd_acquired && soa->serial == zone->soa_nsd.serial)
1504 int cmp = compare_serial(ntohl(soa->serial), ntohl(zone->soa_disk.serial));
1506 /* soa is from an update if serial equals soa_disk.serial or
1520 /* soa in disk has been loaded in memory */
1523 soa_serial = ntohl(soa->serial);
1532 zone->soa_nsd = *soa;
1544 /* update refresh timers based on disk soa, unless there are
1590 zone->apex_str, (unsigned)ntohl(soa
1591 zone->soa_nsd = *soa;
1592 zone->soa_disk = *soa;
1966 static int xfrd_parse_soa_info(buffer_type* packet, xfrd_soa_type* soa)
1970 soa->type = htons(buffer_read_u16(packet));
1971 soa->klass = htons(buffer_read_u16(packet));
1972 soa->ttl = htonl(buffer_read_u32(packet));
1973 if(ntohs(soa->type) != TYPE_SOA || ntohs(soa->klass) != CLASS_IN)
1979 !(soa->prim_ns[0] = dname_make_wire_from_packet(soa->prim_ns+1, packet, 1)) ||
1980 !(soa->email[0] = dname_make_wire_from_packet(soa->email+1, packet, 1)))
1984 soa->serial = htonl(buffer_read_u32(packet));
1985 soa->refresh = htonl(buffer_read_u32(packet));
1986 soa->retry = htonl(buffer_read_u32(packet));
1987 soa->expire = htonl(buffer_read_u32(packet));
1988 soa->minimum = htonl(buffer_read_u32(packet));
1997 * done = 1 if the last SOA in an IXFR/AXFR has been seen.
1998 * soa then contains that soa info.
1999 * (soa contents is modified by the routine)
2003 int *done, xfrd_soa_type* soa, region_type* temp)
2061 if(!xfrd_parse_soa_info(packet, soa)) {
2067 ntohl(soa->serial) != zone->latest_xfr->msg_new_serial) {
2068 /* 2nd RR is SOA with lower serial, this is an IXFR */
2075 if(ntohl(soa->serial) != ntohl(zone->soa_disk.serial)) {
2080 zone->latest_xfr->msg_old_serial = ntohl(soa->serial);
2081 tmp_serial = ntohl(soa->serial);
2083 else if(ntohl(soa->serial) == zone->latest_xfr->msg_new_serial) {
2084 /* saw another SOA of new serial. */
2086 zone->latest_xfr->msg_is_ixfr = 2; /* seen middle SOA in ixfr */
2088 /* 2nd SOA for AXFR or 3rd newSOA for IXFR */
2094 if(ntohl(soa->serial) > zone->latest_xfr->msg_new_serial) {
2099 if(ntohl(soa->serial) < tmp_serial) {
2105 tmp_serial = ntohl(soa->serial);
2173 xfrd_soa_type* soa)
2259 if(!packet_skip_dname(packet) || !xfrd_parse_soa_info(packet, soa)) {
2261 "no SOA begins authority section",
2277 "parse error in SOA record",
2284 "wrong SOA record",
2290 /* parse the first RR, see if it is a SOA */
2291 if(!xfrd_parse_soa_info(packet, soa))
2294 "bad SOA rdata",
2301 compare_serial(ntohl(soa->serial), ntohl(zone->soa_disk.serial)) < 0) {
2304 zone->apex_str, ntohl(zone->soa_disk.serial), ntohl(soa->serial), zone->master->ip_address_spec));
2307 zone->apex_str, ntohl(zone->soa_disk.serial), ntohl(soa->serial), zone->master->ip_address_spec));
2311 if(zone->soa_disk_acquired != 0 && zone->soa_disk.serial == soa->serial) {
2316 /* (even if notified) the lease on the current soa is renewed */
2318 if(zone->soa_nsd.serial == soa->serial)
2339 %u, reply %u).", (unsigned)zone->soa_disk_acquired ? ntohl(zone->soa_disk.serial) : 0, (unsigned)ntohl(soa->serial)));
2343 (void)xfrd_handle_incoming_notify(zone, soa);
2346 compare_serial(ntohl(zone->soa_notified.serial), ntohl(soa->serial)) < 0) {
2348 zone->soa_notified.serial = soa->serial;
2350 zone->latest_xfr->msg_new_serial = ntohl(soa->serial);
2377 if(!xfrd_xfr_check_rrs(zone, packet, ancount_todo, &done, soa,
2462 xfrd_soa_type soa;
2468 switch((res=xfrd_parse_received_xfr_packet(zone, packet, &soa)))
2633 zone->soa_disk = soa;
2717 xfrd_handle_notify_and_start_xfr(xfrd_zone_type* zone, xfrd_soa_type* soa)
2719 if(xfrd_handle_incoming_notify(zone, soa)) {
2765 xfrd_soa_type soa;
2768 /* get serial from a SOA */
2770 xfrd_parse_soa_info(packet, &soa)) {
2773 xfrd_handle_notify_and_start_xfr(zone, have_soa?&soa:NULL);
2793 xfrd_handle_incoming_notify(xfrd_zone_type* zone, xfrd_soa_type* soa)
2795 if(soa && zone->soa_disk_acquired && zone->state != xfrd_zone_expired &&
2796 compare_serial(ntohl(soa->serial),ntohl(zone->soa_disk.serial)) <= 0)
2800 "(soa disk serial %u)", zone->apex_str,
2801 (unsigned)ntohl(soa->serial),
2805 if(soa == 0) {
2810 compare_serial(ntohl(soa->serial),
2813 zone->soa_notified = *soa;
2862 /* zone has sent update and no (or different) nsd soa, the
2868 xfrd_soa_type soa;
2869 soa.serial = htonl(xfr->msg_new_serial);
2870 log_msg(LOG_ERR, "xfrd: zone %s: soa serial %u update "
2874 /* revert the soa; it has not been acquired properly */
2882 /* revert soa to the one in server */
2886 /* fabricate soa and trigger notify to refetch and
2888 memset(&soa, 0, sizeof(soa));
2889 soa.serial = htonl(xfr->msg_new_serial);
2890 xfrd_handle_incoming_notify(zone, &soa);