40 #include <sys/socket.h>
42 static const char* notify_str =
"notify";
44 static void notify_handle_zone(
netio_type* netio,
75 if(t > notify_time(notify) + 10) {
76 time_t extra = t - notify_time(notify);
77 time_t base = extra*9/10;
78 t = notify_time(notify) + base +
79 random()%(extra-base);
97 if (!xfrhandler || !zone) {
103 "allocator_create() failed", notify_str);
109 " allocator_alloc() failed", notify_str);
160 notify_set_timer(notify, notify_time(notify));
199 notify_str, zone->
name);
227 ods_log_debug(
"[%s] zone %s no more secondaries, disable notify",
228 notify_str, zone->
name);
229 notify_disable(notify);
243 ssize_t received = 0;
250 if (received == -1) {
251 ods_log_error(
"[%s] unable to read packet: recvfrom() failed fd %d "
252 "(%s)", notify_str, notify->
handler.
fd, strerror(errno));
279 ods_log_error(
"[%s] zone %s received bad notify reply opcode/qr",
280 notify_str, zone->
name);
285 notify_str, zone->
name);
292 notify_str, zone->
name, str?str:
"UNKNOWN" );
298 ods_log_debug(
"[%s] zone %s secondary %s notify reply ok", notify_str,
311 struct sockaddr_storage to;
312 socklen_t to_len = 0;
327 fd = socket(family, SOCK_DGRAM, IPPROTO_UDP);
340 (
struct sockaddr*)&to, to_len);
367 ods_log_error(
"[%s] unable to sign notify: tsig unknown algorithm "
384 ods_log_debug(
"[%s] tsig append rr to notify id=%u", notify_str,
425 notify_tsig_sign(notify, xfrhandler->
packet);
430 ods_log_error(
"[%s] unable to send notify retry %u for zone %s to "
431 "%s: notify_send_udp() failed", notify_str, notify->
retry,
435 ods_log_verbose(
"[%s] notify retry %u for zone %s sent to %s", notify_str,
446 notify_handle_zone(
netio_type* ATTR_UNUSED(netio),
465 ods_log_debug(
"[%s] already waiting, skipping notify for zone %s",
466 notify_str, zone->
name);
474 if (notify_udp_read_packet(notify)) {
475 if (notify_handle_reply(notify)) {
505 notify_update_soa(
notify_type* notify, ldns_rr* soa)
511 ldns_rr_free(notify->
soa);
545 notify_update_soa(notify, soa);
547 ods_log_debug(
"[%s] zone %s already on waiting list", notify_str,
552 notify_setup(notify);
569 ods_log_debug(
"[%s] zone %s notify on waiting list", notify_str,
592 ldns_rr_free(notify->
soa);