diff --git a/difffile.c b/difffile.c index c4d18ad96..0e2a7a86d 100644 --- a/difffile.c +++ b/difffile.c @@ -1276,8 +1276,7 @@ check_for_bad_serial(namedb_type* db, const char* zone_str, uint32_t old_serial) int apply_ixfr_for_zone(nsd_type* nsd, zone_type* zone, FILE* in, - struct nsd_options* ATTR_UNUSED(opt), udb_base* taskudb, udb_ptr* last_task, - uint32_t xfrfilenr) + struct nsd_options* ATTR_UNUSED(opt), udb_base* taskudb, uint32_t xfrfilenr) { char zone_buf[3072]; char log_buf[5120]; @@ -1289,7 +1288,6 @@ apply_ixfr_for_zone(nsd_type* nsd, zone_type* zone, FILE* in, uint8_t committed; uint32_t i; int num_bytes = 0; - (void)last_task; assert(zone); /* read zone name and serial */ @@ -2085,9 +2083,8 @@ task_process_zonestat_inc(struct nsd* nsd, udb_base* udb, udb_ptr *last_task, } #endif -static void -task_process_apply_xfr(struct nsd* nsd, udb_base* udb, udb_ptr *last_task, - udb_ptr* task) +void +task_process_apply_xfr(struct nsd* nsd, udb_base* udb, udb_ptr* task) { /* we have to use an udb_ptr task here, because the apply_xfr procedure * appends soa_info which may remap and change the pointer. */ @@ -2099,6 +2096,7 @@ task_process_apply_xfr(struct nsd* nsd, udb_base* udb, udb_ptr *last_task, if(!zone) { /* assume the zone has been deleted and a zone transfer was * still waiting to be processed */ + udb_ptr_free_space(task, udb, TASKLIST(task)->size); return; } @@ -2110,10 +2108,11 @@ task_process_apply_xfr(struct nsd* nsd, udb_base* udb, udb_ptr *last_task, /* soainfo_gone will be communicated from server_reload, unless preceding updates have been applied */ zone->is_skipped = 1; + udb_ptr_free_space(task, udb, TASKLIST(task)->size); return; } /* read and apply zone transfer */ - switch(apply_ixfr_for_zone(nsd, zone, df, nsd->options, udb, last_task, + switch(apply_ixfr_for_zone(nsd, zone, df, nsd->options, udb, TASKLIST(task)->yesno)) { case 1: /* Success */ break; @@ -2131,6 +2130,7 @@ task_process_apply_xfr(struct nsd* nsd, udb_base* udb, udb_ptr *last_task, default:break; } fclose(df); + udb_ptr_free_space(task, udb, TASKLIST(task)->size); } @@ -2176,9 +2176,6 @@ void task_process_in_reload(struct nsd* nsd, udb_base* udb, udb_ptr *last_task, task_process_zonestat_inc(nsd, udb, last_task, TASKLIST(task)); break; #endif - case task_apply_xfr: - task_process_apply_xfr(nsd, udb, last_task, task); - break; case task_add_cookie_secret: task_process_add_cookie_secret(nsd, TASKLIST(task)); break; diff --git a/difffile.h b/difffile.h index 4a88d4b1d..679aa2c35 100644 --- a/difffile.h +++ b/difffile.h @@ -68,8 +68,7 @@ int add_RR(namedb_type* db, const dname_type* dname, /* apply the xfr file identified by xfrfilenr to zone */ int apply_ixfr_for_zone(struct nsd* nsd, zone_type* zone, FILE* in, - struct nsd_options* opt, udb_base* taskudb, udb_ptr* last_task, - uint32_t xfrfilenr); + struct nsd_options* opt, udb_base* taskudb, uint32_t xfrfilenr); enum soainfo_hint { soainfo_ok, @@ -157,6 +156,7 @@ void task_new_drop_cookie_secret(udb_base* udb, udb_ptr* last); void task_new_activate_cookie_secret(udb_base* udb, udb_ptr* last); int task_new_apply_xfr(udb_base* udb, udb_ptr* last, const dname_type* zone, uint32_t old_serial, uint32_t new_serial, uint64_t filenumber); +void task_process_apply_xfr(struct nsd* nsd, udb_base* udb, udb_ptr *task); void task_process_in_reload(struct nsd* nsd, udb_base* udb, udb_ptr *last_task, udb_ptr* task); void task_process_expire(namedb_type* db, struct task_list_d* task); diff --git a/ipc.c b/ipc.c index 44fdd4265..6185c004e 100644 --- a/ipc.c +++ b/ipc.c @@ -516,6 +516,16 @@ parent_handle_reload_command(netio_type *ATTR_UNUSED(netio), } parent_check_all_children_exited(nsd); break; + case NSD_QUIT_NOTIFIER: + /* This process only served as pass through for notifies (from + * the serve processes). When this signal is received, this + * process should quit immediately. + */ + DEBUG(DEBUG_IPC,1, (LOG_INFO, "parent_handle_reload_command: " + "quit notifier")); + /* Do silent shutdown in server_main */ + nsd->mode = NSD_QUIT_NOTIFIER; + break; default: log_msg(LOG_ERR, "handle_reload_command: bad mode %d", (int) mode); diff --git a/nsd.h b/nsd.h index d5f3bdf34..0dfd67e5f 100644 --- a/nsd.h +++ b/nsd.h @@ -76,6 +76,15 @@ struct dt_collector; */ #define NSD_RELOAD_FAILED 14 +/* + * QUIT_NOTIFIER is sent to the "notifier" process that is responsible for + * channeling incoming notifies from the server processes to the transfer + * daemon (via NSD_PASS_TO_XFRD), when the "reload" process is applying non-xfr + * tasks (like writing zone files which may take long). + */ +#define NSD_QUIT_NOTIFIER 15 + + #define NSD_SERVER_MAIN 0x0U #define NSD_SERVER_UDP 0x1U #define NSD_SERVER_TCP 0x2U diff --git a/server.c b/server.c index 235645691..e0eb73859 100644 --- a/server.c +++ b/server.c @@ -2267,48 +2267,97 @@ block_read(struct nsd* nsd, int s, void* p, ssize_t sz, int timeout) return total; } +static size_t +reload_count_non_xfr_tasks(udb_base* u) +{ + udb_ptr t; + size_t count = 0; + + udb_ptr_new(&t, u, udb_base_get_userdata(u)); + while(!udb_ptr_is_null(&t)) { + if(TASKLIST(&t)->task_type != task_apply_xfr) + count += 1; + udb_ptr_set_rptr(&t, u, &TASKLIST(&t)->next); + } + return count; +} + static void -reload_process_tasks(struct nsd* nsd, udb_ptr* last_task, int cmdsocket) +reload_process_non_xfr_tasks(struct nsd* nsd, udb_ptr* xfrs2process, + udb_ptr* last_task) { - sig_atomic_t cmd = NSD_QUIT_SYNC; - udb_ptr t, next; + udb_ptr t, next, xfr_tail; udb_base* u = nsd->task[nsd->mytask]; udb_ptr_init(&next, u); + udb_ptr_init(&xfr_tail, u); udb_ptr_new(&t, u, udb_base_get_userdata(u)); udb_base_set_userdata(u, 0); + /* Execute all tasks except of type "task_apply_xfr". */ while(!udb_ptr_is_null(&t)) { /* store next in list so this one can be deleted or reused */ udb_ptr_set_rptr(&next, u, &TASKLIST(&t)->next); udb_rptr_zero(&TASKLIST(&t)->next, u); - /* process task t */ - /* append results for task t and update last_task */ - task_process_in_reload(nsd, u, last_task, &t); + if(TASKLIST(&t)->task_type != task_apply_xfr) { + /* process task t */ + /* append results for task t and update last_task */ + task_process_in_reload(nsd, u, last_task, &t); + } else if(udb_ptr_is_null(xfrs2process)) { + udb_ptr_set_ptr( xfrs2process, u, &t); + udb_ptr_set_ptr(&xfr_tail, u, &t); + } else { + udb_rptr_set_ptr(&TASKLIST(&xfr_tail)->next, u, &t); + udb_ptr_set_ptr(&xfr_tail, u, &t); + } /* go to next */ udb_ptr_set_ptr(&t, u, &next); + } + /* t and next are already unlinked (because they are null) */ + udb_ptr_unlink(&xfr_tail, u); +} - /* if the parent has quit, we must quit too, poll the fd for cmds */ - if(block_read(nsd, cmdsocket, &cmd, sizeof(cmd), 0) == sizeof(cmd)) { - DEBUG(DEBUG_IPC,1, (LOG_INFO, "reload: ipc command from main %d", (int)cmd)); - if(cmd == NSD_QUIT) { - DEBUG(DEBUG_IPC,1, (LOG_INFO, "reload: quit to follow nsd")); - /* unlink files of remainder of tasks */ - while(!udb_ptr_is_null(&t)) { - if(TASKLIST(&t)->task_type == task_apply_xfr) { - xfrd_unlink_xfrfile(nsd, TASKLIST(&t)->yesno); - } - udb_ptr_set_rptr(&t, u, &TASKLIST(&t)->next); - } - udb_ptr_unlink(&t, u); - udb_ptr_unlink(&next, u); - exit(0); +static size_t +reload_process_xfr_tasks(struct nsd* nsd, int cmdsocket, udb_ptr* xfrs2process) +{ + sig_atomic_t cmd = NSD_QUIT_SYNC; + udb_ptr next; + udb_base* u = nsd->task[nsd->mytask]; + size_t xfrs_processed = 0; + + udb_ptr_init(&next, u); + while(!udb_ptr_is_null(xfrs2process)) { + /* store next in list so this one can be deleted or reused */ + udb_ptr_set_rptr(&next, u, &TASKLIST(xfrs2process)->next); + udb_rptr_zero(&TASKLIST(xfrs2process)->next, u); + + /* process xfr task at xfrs2process */ + assert(TASKLIST(xfrs2process)->task_type == task_apply_xfr); + task_process_apply_xfr(nsd, u, xfrs2process); + xfrs_processed += 1; + + /* go to next */ + udb_ptr_set_ptr(xfrs2process, u, &next); + + /* if the "old-main" has quit, we must quit too, poll the fd for cmds */ + if(block_read(nsd, cmdsocket, &cmd, sizeof(cmd), 0) != sizeof(cmd)) + ; /* pass */ + else if (cmd != NSD_QUIT) + DEBUG(DEBUG_IPC,1, (LOG_INFO, "reload: ipc command from old-main %d", (int)cmd)); + else { + udb_ptr_unlink(&next, u); + DEBUG(DEBUG_IPC,1, (LOG_INFO, "reload: quit to follow nsd")); + /* unlink files of remainder of tasks */ + while(!udb_ptr_is_null(xfrs2process)) { + assert(TASKLIST(xfrs2process)->task_type == task_apply_xfr); + xfrd_unlink_xfrfile(nsd, TASKLIST(xfrs2process)->yesno); + udb_ptr_set_rptr(xfrs2process, u, &TASKLIST(xfrs2process)->next); } + exit(0); } - } - udb_ptr_unlink(&t, u); - udb_ptr_unlink(&next, u); + /* xfrs2process and next are already unlinked (because they are null) */ + return xfrs_processed; } static void server_verify(struct nsd *nsd, int cmdsocket, @@ -2392,11 +2441,10 @@ static void server_reload_handle_quit_sync_ack(int cmdsocket, short event, */ static void server_reload(struct nsd *nsd, region_type* server_region, netio_type* netio, - int cmdsocket) + int cmdsocket, udb_ptr* xfrs2process, udb_ptr* last_task) { pid_t mypid; sig_atomic_t cmd; - udb_ptr last_task; struct sigaction old_sigchld, ign_sigchld; struct radnode* node; zone_type* zone; @@ -2404,6 +2452,7 @@ server_reload(struct nsd *nsd, region_type* server_region, netio_type* netio, struct quit_sync_event_data cb_data; struct event signal_event, cmd_event; struct timeval reload_sync_timeout; + size_t xfrs_processed = 0; /* ignore SIGCHLD from the previous server_main that used this pid */ memset(&ign_sigchld, 0, sizeof(ign_sigchld)); @@ -2417,9 +2466,7 @@ server_reload(struct nsd *nsd, region_type* server_region, netio_type* netio, #endif /* see what tasks we got from xfrd */ - task_remap(nsd->task[nsd->mytask]); - udb_ptr_init(&last_task, nsd->task[nsd->mytask]); - reload_process_tasks(nsd, &last_task, cmdsocket); + xfrs_processed = reload_process_xfr_tasks(nsd, cmdsocket, xfrs2process); #ifndef NDEBUG if(nsd_debug_level >= 1) @@ -2456,10 +2503,9 @@ server_reload(struct nsd *nsd, region_type* server_region, netio_type* netio, #endif } - for(node = radix_first(nsd->db->zonetree); - node != NULL; - node = radix_next(node)) - { + if(xfrs_processed) for( node = radix_first(nsd->db->zonetree) + ; node != NULL; node = radix_next(node)) { + zone = (zone_type *)node->elem; if(zone->is_updated) { if(zone->is_bad) { @@ -2471,12 +2517,12 @@ server_reload(struct nsd *nsd, region_type* server_region, netio_type* netio, /* update(s), verified or not, possibly with subsequent skipped update(s). skipped update(s) are picked up by failed update check in xfrd */ - task_new_soainfo(nsd->task[nsd->mytask], &last_task, + task_new_soainfo(nsd->task[nsd->mytask], last_task, zone, hint); } else if(zone->is_skipped) { /* corrupt or inconsistent update without preceding update(s), communicate soainfo_gone */ - task_new_soainfo(nsd->task[nsd->mytask], &last_task, + task_new_soainfo(nsd->task[nsd->mytask], last_task, zone, soainfo_gone); } zone->is_updated = 0; @@ -2569,7 +2615,7 @@ server_reload(struct nsd *nsd, region_type* server_region, netio_type* netio, exit(1); } assert(cmd == NSD_RELOAD); - udb_ptr_unlink(&last_task, nsd->task[nsd->mytask]); + udb_ptr_unlink(last_task, nsd->task[nsd->mytask]); task_process_sync(nsd->task[nsd->mytask]); #ifdef USE_ZONE_STATS server_zonestat_realloc(nsd); /* realloc for next children */ @@ -2646,6 +2692,12 @@ server_main(struct nsd *nsd) netio_type *netio = netio_create(server_region); netio_handler_type reload_listener; int reload_sockets[2] = {-1, -1}; + /* pointer to the xfr tasks that will be processed in a second pass */ + udb_ptr xfrs2process; + /* pointer to results of task processing */ + udb_ptr last_task; + /* number of non xfr tasks to process */ + size_t n_non_xfr_tasks; struct timespec timeout_spec; int status; pid_t child_pid; @@ -2663,6 +2715,8 @@ server_main(struct nsd *nsd) nsd->st->db_disk = 0; nsd->st->db_mem = region_get_mem(nsd->db->region); #endif + memset(&xfrs2process, 0, sizeof(xfrs2process)); + memset(&last_task, 0, sizeof(last_task)); /* Start the child processes that handle incoming queries */ if (server_start_children(nsd, server_region, netio, @@ -2863,7 +2917,99 @@ server_main(struct nsd *nsd) reload_pid = -1; break; } + /* Execute the tasks that cannot fail */ +#ifdef HAVE_SETPROCTITLE + setproctitle("load"); +#endif +#ifdef USE_LOG_PROCESS_ROLE + log_set_process_role("load"); +#endif + /* Already process the non xfr tasks, so that a failed + * transfer (which can exit) will not nullify the + * effects of the other tasks that will not exit. + */ + task_remap(nsd->task[nsd->mytask]); + n_non_xfr_tasks = reload_count_non_xfr_tasks( + nsd->task[nsd->mytask]); + if(n_non_xfr_tasks == 0) + ; /* pass */ + + else if ((reload_pid = fork()) == -1) { + log_msg(LOG_ERR, "fork failed: %s" + , strerror(errno)); + break; + + } else if (reload_pid == 0) { + /* CHILD - keep listening to serve processes + * for passing on the notifies to xfrd + * until NSD_QUIT_NOTIFIER + */ + close(reload_sockets[1]); +#ifdef HAVE_SETPROCTITLE + setproctitle("ntfy"); +#endif +#ifdef USE_LOG_PROCESS_ROLE + log_set_process_role("ntfy"); +#endif + reload_listener.fd = reload_sockets[0]; + reload_listener.timeout = NULL; + reload_listener.user_data = nsd; + reload_listener.event_types = NETIO_EVENT_READ; + /* listens to Quit */ + reload_listener.event_handler = + parent_handle_reload_command; + netio_add_handler(netio, &reload_listener); + reload_pid = getppid(); + break; /* Breaks into server_main loop */ + } else { + /* PARENT - load */ + close(reload_sockets[0]); +#if 0 + /* Sleep used to test that notifies are + * actually passed through (and they did). + * Alternatively we could make a sleep task + * and compagnion sleep command to nsd-control + * to create a unit test for this. Maybe only + * if enabled by a configure option. + */ + sleep(10); +#endif + } + udb_ptr_init(&xfrs2process, nsd->task[nsd->mytask]); + udb_ptr_init(&last_task , nsd->task[nsd->mytask]); + reload_process_non_xfr_tasks(nsd, &xfrs2process + , &last_task); + if(n_non_xfr_tasks) { + sig_atomic_t cmd; + + /* Send quit command to notifier, not waiting + * for confirmation. + */ + DEBUG(DEBUG_IPC,1, (LOG_INFO, "reload: " + "ipc send immediate quit to main")); + cmd = NSD_QUIT_NOTIFIER; + if (!write_socket(reload_sockets[1], + &cmd, sizeof(cmd))) { + log_msg(LOG_ERR, "problems sending " + "immediate quit to notifier: " + "%s", strerror(errno)); + } + close(reload_sockets[1]); + /* Create a new reload socket pair, for + * communications with old-main while applying + * possible remaining transfer tasks and while + * spawning the new serve childs. + */ + if (socketpair(AF_UNIX, SOCK_STREAM, 0, + reload_sockets) == -1) { + log_msg(LOG_ERR,"reload failed on " + "socketpair: %s", + strerror(errno)); + reload_pid = -1; + break; + } + } /* Do actual reload */ reload_pid = fork(); switch (reload_pid) { @@ -2873,21 +3019,11 @@ server_main(struct nsd *nsd) default: /* PARENT */ close(reload_sockets[0]); -#ifdef HAVE_SETPROCTITLE - setproctitle("load"); -#endif -#ifdef USE_LOG_PROCESS_ROLE - log_set_process_role("load"); -#endif - server_reload(nsd, server_region, netio, - reload_sockets[1]); + server_reload(nsd, server_region, netio + , reload_sockets[1] + , &xfrs2process + , &last_task); DEBUG(DEBUG_IPC,2, (LOG_INFO, "Reload exited to become new main")); -#ifdef HAVE_SETPROCTITLE - setproctitle("main"); -#endif -#ifdef USE_LOG_PROCESS_ROLE - log_set_process_role("main"); -#endif close(reload_sockets[1]); DEBUG(DEBUG_IPC,2, (LOG_INFO, "Reload closed")); /* drop stale xfrd ipc data */ @@ -2919,6 +3055,24 @@ server_main(struct nsd *nsd) reload_pid = getppid(); break; } + if(reload_pid == -1) { + /* Reset proctitle after "load" process exited + * or when fork() failed + */ +#ifdef HAVE_SETPROCTITLE + setproctitle("main"); +#endif +#ifdef USE_LOG_PROCESS_ROLE + log_set_process_role("main"); +#endif + } + /* xfrs2process and last_task need to be reset in case + * "old-main" becomes "main" (due to an failed (exited) + * xfr update). If needed xfrs2process gets unlinked by + * "load", and last_task by the xfrd. + */ + memset(&xfrs2process, 0, sizeof(xfrs2process)); + memset(&last_task, 0, sizeof(last_task)); break; case NSD_QUIT_SYNC: /* synchronisation of xfrd, parent and reload */ @@ -2959,6 +3113,19 @@ server_main(struct nsd *nsd) #endif server_shutdown(nsd); + /* ENOTREACH */ + break; + case NSD_QUIT_NOTIFIER: + /* silent shutdown of this "notifier" process, + * leaving all other processes undisturbed */ + assert(reload_listener.fd != -1); + close(reload_listener.fd); + DEBUG(DEBUG_IPC,1, (LOG_INFO, "server_main: shutdown sequence")); +#ifdef MEMCLEAN /* OS collects memory pages */ + region_destroy(server_region); +#endif + server_shutdown(nsd); + /* ENOTREACH */ break; case NSD_SHUTDOWN: diff --git a/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.control.key b/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.control.key new file mode 100644 index 000000000..ec291acc9 --- /dev/null +++ b/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.control.key @@ -0,0 +1,40 @@ +-----BEGIN PRIVATE KEY----- +MIIG/gIBADANBgkqhkiG9w0BAQEFAASCBugwggbkAgEAAoIBgQC9u0DBJJwVyErW +pRAYQU1kmKa59gQAkmg0mrNUMDa+JYJj5U//XoGODBWJwkhdyO65NwNSVI5bkRzi +vKcd7kIl8uwD5lTQYl4ArGKX8A1K0JtTXZ8L8+nQJRWexlVLEwjMbwT6MWHLt92A +8qLKZQxzOf7WN2lj6AuHBC2hSewZuo9rhW57y8uAOiH8OTygFh4inSeozdsCiEq5 +hI4kWpcHHj0KE2Sf2Ngje9U9hDXgcUwRABwIGfT1KG/gT6BQxvrVtaAPQBJxdJHX +RkM9l857x64LbFHHcM2G3GEHBlcLv+LlA+RKg9zMbppnaZzlfDK9zZx79qPTiPfv +kH2HEtiPiiulzzDbncXHHJguXE9WIBCpNedXeMffevUqiDb9rnsQ7r9sNtXu9FDH +qSMbSBX00ZJIEFaauAL1EyFyK6owqLFwbnWI9WlxW+C/2XzDhs9FUH1SRigT8JLY +wgwwv+uMTTb1x11qyihBrYJZAWXix4oqL9HVUaGetTFAP3LeLYMCAwEAAQKCAYA8 +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SvSTrOoZwNBUQNw5PuXZ +n3AL5l9+ctrAxsRjGU6JP2hysr63B6cVKRt1fyz9Ubsqpgk5NIStnBemzWDAOwl0 ++cFp5BGrYF8hfekyl6drHS5mmrAsrtRbwmf2P9Gwa+XOy3M4fyHRzohFXoDPDQL2 +GTde1NB1wazIWNCTgjB9Km3AawxYsnVBLXoDQlUExsmSLoTeFOM6fzPQKfC6wekH +tS+oFHCn2JKmFHUCgcEAq3rSv821j48cXVtW5A55bMqiThZiOzZMT04IpeABPdO4 ++eoZwi0KtBRtf47BKCOqSz9Q52KnhTLruhizcaeuYs08Di1C3G5uXi8PqVb8/mtj +7EokXPZJIoHUxHJHFYVWIGjM5CVrwgVzhZrHHjJClEmhbiLITLbrfbLTPIFmJFy2 +cqEkPagw1tlvVztiUhy/dRkqdNclVo23MEYiJZv6/lfp2/QhpWSNyfZUR5Y0nRXS +RsBY/grrbedzNPRIG3YBAoHAYulVIX0Bt5HFJznpoZsAPt5z3LuX1I2qnyFwQOPE +k9QnSKKj7/BuG5qXWKEur3WgsCWnLMkieSZhfqK3+kBii2gyWgjR1uVsYT/SJuMh +tqDJOwew2RN3B+xCydIT0PRubeKns1A4qeuAv1Juxw0S9wg6hBGb6GO12SkncYk3 +uQ3Qyahhyo+OIBf5y7BOcLKRm07AI2x6C3MTYyTwAV9VS2ByNsGxtVQysooeaam/ +Lfohlvr92Vv2N1gGcBSyrwTY +-----END PRIVATE KEY----- diff --git a/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.control.pem b/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.control.pem new file mode 100644 index 000000000..6fd77a839 --- /dev/null +++ b/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.control.pem @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIIEGjCCAoKgAwIBAgIUdd5j+EPMyI74clpGCDGKjZLy7iMwDQYJKoZIhvcNAQEL +BQAwDjEMMAoGA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X1mUrKryoYAeS +T61yb1//B7FOMvWo5UKW2u2X/jJIFR1OtawXMwhGUm1TrUhbdD0Sr+dH5hgNx4Ad +j8idIAgfHOrrPVGMTVactX5b4Lv8m9H6xD7wQVw8NcO2O4aXHNxOmBl9Dex2kaOK +OntvaBTmbZJ42ydenfnR5U/FrK3u8cnk1oT8qfX31fHS/T4MPIRqvbUZcftGQ4Xn +xA3eqOFG7idiGENNWln8PbmxBootacpBNCf4Za1Tvr9u8eENAbcBv8mtGp45iQ== +-----END CERTIFICATE----- diff --git a/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.datafile b/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.datafile new file mode 100644 index 000000000..218868990 --- /dev/null +++ b/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.datafile @@ -0,0 +1,47 @@ + +;; AXFR serial=1 +ENTRY_BEGIN +MATCH opcode qtype qname +REPLY QUERY NOERROR AA +ADJUST copy_id +SECTION QUESTION +zone2fail.invalid. IN AXFR +SECTION ANSWER +zone2fail.invalid. 60 SOA ns.invalid. noreply.invalid. 1 600 500 900 300 +zone2fail.invalid. 60 TXT "This should just succeed" +zone2fail.invalid. 60 SOA ns.invalid. noreply.invalid. 1 600 500 900 300 +ENTRY_END + +;; AXFR serial=1 +ENTRY_BEGIN +MATCH opcode qtype qname +REPLY QUERY NOERROR AA +ADJUST copy_id +SECTION QUESTION +absent-zone.invalid. IN AXFR +SECTION ANSWER +absent-zone.invalid. 60 SOA ns.invalid. noreply.invalid. 1 600 500 900 300 +absent-zone.invalid. 60 TXT "This zone should be added to the serve process, " +absent-zone.invalid. 60 TXT "but isn't when it's added just after a failed transfer" +absent-zone.invalid. 60 SOA ns.invalid. noreply.invalid. 1 600 500 900 300 +ENTRY_END + +;; IXFR serial=1 to serial=2 +ENTRY_BEGIN +MATCH opcode qtype qname +MATCH serial=1 +REPLY QUERY NOERROR AA +ADJUST copy_id +SECTION QUESTION +zone2fail.invalid. IN IXFR +SECTION ANSWER +zone2fail.invalid. 60 SOA ns.invalid. noreply.invalid. 2 600 500 900 300 +zone2fail.invalid. 60 SOA ns.invalid. noreply.invalid. 1 600 500 900 300 +; deleted items +zone2fail.invalid. 60 TXT "This was not there" +zone2fail.invalid. 60 SOA ns.invalid. noreply.invalid. 2 600 500 900 300 +; added items +zone2fail.invalid. 60 SOA ns.invalid. noreply.invalid. 2 600 500 900 300 +ENTRY_END + + diff --git a/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.dsc b/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.dsc new file mode 100644 index 000000000..4fe0de789 --- /dev/null +++ b/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.dsc @@ -0,0 +1,18 @@ +BaseName: bad_xfr_with_other_tasks +Version: 1.0 +Description: Check failed update with addzone in tasklist (add zone should be applied and failed update should not) +CreationDate: za 25 mei 2024 13:13:01 CEST +Maintainer: Willem Toorop +Category: +Component: +Depends: +Help: +Pre: bad_xfr_with_other_tasks.pre +Post: bad_xfr_with_other_tasks.post +Test: bad_xfr_with_other_tasks.test +AuxFiles: bad_xfr_with_other_tasks.secondary.conf.in, + bad_xfr_with_other_tasks_server.key, bad_xfr_with_other_tasks_server.pem, + bad_xfr_with_other_tasks_control.key, bad_xfr_with_other_tasks_control.pem, + bad_xfr_with_other_tasks.datafile +Passed: +Failure: diff --git a/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.post b/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.post new file mode 100644 index 000000000..ba053d488 --- /dev/null +++ b/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.post @@ -0,0 +1,15 @@ +# #-- bad_xfr_with_other_tasks.post --# +# source the master var file when it's there +[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master +# source the test var file when it's there +[ -f .tpkg.var.test ] && source .tpkg.var.test + +. ../common.sh + +# do your teardown here +( + kill_from_pidfile secondary.pid & + kill_from_pidfile primary.pid & + wait +) + diff --git a/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.pre b/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.pre new file mode 100644 index 000000000..ab05add7e --- /dev/null +++ b/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.pre @@ -0,0 +1,39 @@ +# #-- bad_xfr_with_other_tasks.pre--# +# source the master var file when it's there +[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master +# use .tpkg.var.test for in test variable passing +[ -f .tpkg.var.test ] && source .tpkg.var.test +. ../common.sh + +if [ -z "$PRIMARY_PORT" ]; then + get_random_port 3 + PRIMARY_PORT=$RND_PORT + SECONDARY_PORT=`expr $RND_PORT + 1` + SECONDARY_CTRL_PORT=`expr $RND_PORT + 2` + + # share the vars + echo "export PRIMARY_PORT=$PRIMARY_PORT" >> .tpkg.var.test + echo "export SECONDARY_PORT=$SECONDARY_PORT" >> .tpkg.var.test + echo "export SECONDARY_CTRL_PORT=$SECONDARY_CTRL_PORT" >> .tpkg.var.test +fi + +PRE="../.." +TPKG_NSD="$PRE/nsd" + +ldns-testns -v -p ${PRIMARY_PORT} bad_xfr_with_other_tasks.datafile > primary.log 2>&1 & +echo $! > primary.pid +wait_ldns_testns_up primary.log + +sed \ + -e "s#@PRIMARY_PORT@#${PRIMARY_PORT}#g" \ + -e "s#@SECONDARY_PORT@#${SECONDARY_PORT}#g" \ + -e "s#@SECONDARY_CTRL_PORT@#${SECONDARY_CTRL_PORT}#g" \ + bad_xfr_with_other_tasks.secondary.conf.in > secondary.conf +rm -f secondary.log secondary-xfrd.state secondary-zone.list +if false +then + $TPKG_NSD -V 2 -L 2 -F 0040 -c secondary.conf +else + $TPKG_NSD -c secondary.conf +fi +wait_nsd_up secondary.log diff --git a/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.secondary.conf.in b/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.secondary.conf.in new file mode 100644 index 000000000..4c29e1646 --- /dev/null +++ b/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.secondary.conf.in @@ -0,0 +1,31 @@ +server: + zonesdir: "." + username: "" + database: "" + verbosity: 2 + ip-address: 127.0.0.1 + port: @SECONDARY_PORT@ + pidfile: "secondary.pid" + logfile: "secondary.log" + xfrdfile: "secondary-xfrd.state" + zonelistfile: "secondary-zone.list" + cookie-secret-file: "secondary_cookiesecrets.txt" + xfrd-reload-timeout: 3600 + +remote-control: + control-enable: yes + control-port: @SECONDARY_CTRL_PORT@ + server-key-file: "bad_xfr_with_other_tasks.server.key" + server-cert-file: "bad_xfr_with_other_tasks.server.pem" + control-key-file: "bad_xfr_with_other_tasks.control.key" + control-cert-file: "bad_xfr_with_other_tasks.control.pem" + +pattern: + name: "secondary" + request-xfr: 127.0.0.1@@PRIMARY_PORT@ NOKEY + allow-notify: 0.0.0.0/0 NOKEY + zonefile: "%s" + +zone: + name: "zone2fail.invalid" + include-pattern: "secondary" diff --git a/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.server.key b/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.server.key new file mode 100644 index 000000000..a069f7561 --- /dev/null +++ b/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.server.key @@ -0,0 +1,40 @@ +-----BEGIN PRIVATE KEY----- +MIIG/QIBADANBgkqhkiG9w0BAQEFAASCBucwggbjAgEAAoIBgQCjsBHexLKQb89F +S+bj3t+QNWMvWgxWReBj7yCjDXGsMU/SaanMUs/4BgTE7IVeaqQQlYlr4TT0m5HS +8UWSIp9BSYH+NA6epbCa7iBFKLOsTOvDAsQuWV3aB1ApqQYGp6Ou2TqIF0DupE0x +jDE32+GEj8p/+jjKhC+BD9XtNf2RyOBQhCgTTlD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UYTNEt9 +PPG/m1FTeHXH407sfqB8frY= +-----END PRIVATE KEY----- diff --git a/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.server.pem b/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.server.pem new file mode 100644 index 000000000..98f5e050c --- /dev/null +++ b/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.server.pem @@ -0,0 +1,25 @@ +-----BEGIN CERTIFICATE----- +MIIEPDCCAqSgAwIBAgIUJGe+SRXT0yBhTv5pnLcuYt/29wgwDQYJKoZIhvcNAQEL +BQAwDjEMMAoGA1UEAwwDbnNkMB4XDTIzMTExOTE2MjUxNFoXDTQzMDgwNjE2MjUx +NFowDjEMMAoGA1UEAwwDbnNkMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKC +AYEAo7AR3sSykG/PRUvm497fkDVjL1oMVkXgY+8gow1xrDFP0mmpzFLP+AYExOyF +XmqkEJWJa+E09JuR0vFFkiKfQUmB/jQOnqWwmu4gRSizrEzrwwLELlld2gdQKakG +Bqejrtk6iBdA7qRNMYwxN9vhhI/Kf/o4yoQvgQ/V7TX9kcjgUIQoE05Q/KCqD8aP +ld09DfH0cpqI1xJU0Ej/HIGXRxFBDlJcohtwAoL9P8CW6ccr7NdpyLyz5lkOC/0L +6kTsFAneLjFJngD0s3LQ+pBvrH9pVT4NEjlvTn+fA5Glh3qelXhKEaItEkKSR/po +PxCOjbAy5b8o0rZGJELioduiP/0DS3rT5kzJQnnrzKFTwde3K9wIcLnSmig+xMFa +G4J7o/XJrp1AyRvzJ42nW6v/2SELknYWt6acdwOPAol9fiMouzwr+6967UAZHJgN +ZiFoq98yx7o2SdMHQUC+t+l8/Xp1cqwruA9uniS4B9VW4cIK2tlD3ZC/aYQO9D6y ++ag/AgMBAAGjgZEwgY4wHQYDVR0OBBYEFPb//R1Ree4/yWEwjm4NDgyZFsVuMEkG +A1UdIwRCMECAFPb//R1Ree4/yWEwjm4NDgyZFsVuoRKkEDAOMQwwCgYDVQQDDANu +c2SCFCRnvkkV09MgYU7+aZy3LmLf9vcIMBIGA1UdEwEB/wQIMAYBAf8CAQAwDgYD +VR0RBAcwBYIDbnNkMA0GCSqGSIb3DQEBCwUAA4IBgQBd6s8T0xbDqPOp4dTn3YDi +y16owyzuIp1yE7Cyi1DJnKYaV43Svsc/M0ERg2nR8mv9Xka5z2rLvma2K00D4rl4 +zIgNrUg99l6TVmf3HHtXbUP4RKRSLivlNj4v2Qf1SlAnFUju0XPNOH7EzuiA/vLi +DVwlLFrqyuayiJqnzmt9lLfwQCgpkzhxoHlAKy/YACLTv21sywzQYpWLupE2r/nG +LSvXCOYquQNeYeiwpyXFptAQFRXcSIYfA3ayiEQWmZ/l1/J/4Xd2PJ++eImPoTMN +rWRgymfVUah0e/G4SXrMmwpT07zdAZ87B2w6wRN3ZJekIoZY7Kqew0v4Knv7yY/Z +H+48gnqK6wznGODW4KRh4Kaje2aYicviCfSEnh+jVRkFZfdBO+OXw9jqdoeaJRRV ++71izHLTmWqMvMKjnYHggxeS7TXcQM761wHAjm+8Zl6p4iMTVqIIKpln2JEteaJ3 +FYZtYjczaItlB5LrP++BrFi95s9sAYJ3SP6Uer4NVPI= +-----END CERTIFICATE----- diff --git a/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.test b/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.test new file mode 100644 index 000000000..01364af80 --- /dev/null +++ b/tpkg/bad_xfr_with_other_tasks.tpkg/bad_xfr_with_other_tasks.test @@ -0,0 +1,39 @@ +# #-- bad_xfr_with_other_tasks.test --# +# source the master var file when it's there +[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master +# use .tpkg.var.test for in test variable passing +[ -f .tpkg.var.test ] && source .tpkg.var.test + +. ../common.sh +PRE="../.." +TPKG_NSD_CONTROL="$PRE/nsd-control" +PRIMARY_CONTROL="$PRE/nsd-control -c primary.conf" +SECONDARY_CONTROL="$PRE/nsd-control -c secondary.conf" + +wait_logfile secondary.log 'zone zone2fail.invalid serial 0 is updated to 1' +ldns-notify -z zone2fail.invalid. -p ${SECONDARY_PORT} -s 2 127.0.0.1 +wait_logfile secondary.log 'zone zone2fail.invalid committed "received update to serial 2' +${SECONDARY_CONTROL} addzone absent-zone.invalid secondary +wait_logfile secondary.log 'diff file zone2fail.invalid. was inconsistent' +${SECONDARY_CONTROL} force_transfer absent-zone.invalid +${SECONDARY_CONTROL} force_transfer zone2fail.invalid +${SECONDARY_CONTROL} reload +wait_logfile secondary.log 'zone zone2fail.invalid serial is updated to 1' + +# We are now in a state where zone2fail.invalid just works, but +# absent-zone.invalid is configured in the transfer daemon, but not in the +# serve processes (when this bug is triggered). + +if [ `drill -Q -ord @127.0.0.1 -p ${SECONDARY_PORT} zone2fail.invalid SOA|wc -l` != 1 ]; then + drill -b 1232 -ord @127.0.0.1 -p ${SECONDARY_PORT} zone2fail.invalid SOA + ${SECONDARY_CONTROL} zonestatus + echo "zone2fail.invalid should have been served" + exit 1 +fi +if [ `drill -Q -ord @127.0.0.1 -p ${SECONDARY_PORT} absent-zone.invalid SOA|wc -l` != 1 ]; then + drill -b 1232 -ord @127.0.0.1 -p ${SECONDARY_PORT} absent-zone.invalid SOA + ${SECONDARY_CONTROL} zonestatus + echo "absent-zone.invalid should have been served" + exit 1 +fi + diff --git a/xfrd.c b/xfrd.c index 4e5fcf82b..dc0c705de 100644 --- a/xfrd.c +++ b/xfrd.c @@ -640,7 +640,7 @@ apply_xfrs_to_consumer_zone(struct xfrd_catalog_consumer_zone* consumer_zone, (long long)xfr->xfrfilenumber, strerror(errno)); } else if(0 >= apply_ixfr_for_zone(xfrd->nsd, dbzone, df, - xfrd->nsd->options, NULL, NULL, xfr->xfrfilenumber)) { + xfrd->nsd->options, NULL, xfr->xfrfilenumber)) { make_catalog_consumer_invalid(consumer_zone, "error processing transfer file %lld", (long long)xfr->xfrfilenumber);