Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fast Reload Option #1042

Open
wants to merge 159 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
a399e7b
- fast-reload, add unbound-control fast_reload
wcawijngaards Nov 3, 2023
a38a37d
- fast-reload, make a thread to service the unbound-control command.
wcawijngaards Nov 3, 2023
88a60f0
- fast-reload, communication sockets for information transfer.
wcawijngaards Nov 3, 2023
bc0c9a4
- fast-reload, fix compile for unbound-dnstap-socket.
wcawijngaards Nov 3, 2023
6b00fd4
- fast-reload, set nonblocking communication to keep the server thread
wcawijngaards Nov 6, 2023
2c0f622
- fast-reload, poll routine to test for readiness, timeout fails conn…
wcawijngaards Nov 6, 2023
3e17db1
- fast-reload, detect loop in sock_poll_timeout routine.
wcawijngaards Nov 6, 2023
43ff8e1
- fast-reload, send done and exited notification.
wcawijngaards Nov 7, 2023
dab478d
- fast-reload, defines for constants in ipc.
wcawijngaards Nov 30, 2023
bc95c79
Merge branch 'master' into fast-reload
wcawijngaards Nov 30, 2023
f2c0e22
- fast-reload, ipc socket recv and send resists partial reads and wri…
wcawijngaards Nov 30, 2023
fcfb3fe
- fast-reload, send exit command to thread when done.
wcawijngaards Nov 30, 2023
32e98b4
- fast-reload, output strings for client on string list.
wcawijngaards Dec 1, 2023
c07e941
- fast-reload, add newline to terminal output.
wcawijngaards Dec 4, 2023
9c6d102
- fast-reload, send client string to remote client.
wcawijngaards Dec 4, 2023
d9b965e
- fast-reload, better debug output.
wcawijngaards Dec 4, 2023
caf6419
- fast-reload, print queue structure, for output to the remote client.
wcawijngaards Dec 8, 2023
8f710f0
Merge branch 'master' into fast-reload
wcawijngaards Dec 8, 2023
f93b718
- fast-reload, move print items to print queue from fast_reload_threa…
wcawijngaards Dec 8, 2023
828f6d7
- fast-reload, keep list of pending print queue items in daemon struct.
wcawijngaards Dec 8, 2023
a882c35
- fast-reload, comment explains in_list for printq to print remainder.
wcawijngaards Dec 8, 2023
82c9e9c
- fast-reload, unit test testdata/fast_reload_thread.tdir that tests the
wcawijngaards Jan 4, 2024
6a2b399
Merge branch 'master' into fast-reload
wcawijngaards Jan 4, 2024
cce409c
- fast-reload, fix test link for fast_reload_printq_list_delete funct…
wcawijngaards Jan 4, 2024
85127a4
- fast-reload, reread config file from disk.
wcawijngaards Jan 4, 2024
4304754
- fast-reload, unshare forwards, making the structure locked, with an…
wcawijngaards Jan 4, 2024
091ea9f
- fast-reload, for nonthreaded, the unbound-control commands forward,
wcawijngaards Jan 4, 2024
5436c9c
Merge branch 'master' into fast-reload
wcawijngaards Jan 4, 2024
39e5959
- fast-reload, unshared stub hints, making the structure locked, with…
wcawijngaards Jan 5, 2024
25aa0be
Merge branch 'master' into fast-reload
wcawijngaards Jan 5, 2024
e146a92
- fast-reload, helpful comments for hints lookup function return value.
wcawijngaards Jan 5, 2024
5c3f72d
- fast-reload, fix bug in fast reload printout, the strlist appendlis…
wcawijngaards Jan 8, 2024
94ef337
- fast-reload, keep track of reloadtime and deletestime and print them.
wcawijngaards Jan 8, 2024
38573f4
- fast-reload, keep track of constructtime and print it.
wcawijngaards Jan 8, 2024
53b647e
- fast-reload, construct new items.
wcawijngaards Jan 8, 2024
b0da43e
- fast-reload, better comment.
wcawijngaards Jan 8, 2024
a57c943
- fast-reload, reload the config and swap trees for forwards and stub…
wcawijngaards Jan 9, 2024
9c1274e
- fast-reload, in forwards_swap_tree set protection of trees with locks.
wcawijngaards Jan 9, 2024
b567a5c
- fast-reload, in hints_swap_tree also swap the node count of the trees.
wcawijngaards Jan 9, 2024
eee7d88
- fast-reload, reload ipc to stop and start threads.
wcawijngaards Jan 9, 2024
9e98d17
Merge branch 'master' into fast-reload
wcawijngaards Jan 9, 2024
bcaebb1
- fast-reload, unused forward declarations removed.
wcawijngaards Jan 11, 2024
c3a754f
- fast-reload, unit test that fast reload works with forwards and stubs.
wcawijngaards Jan 22, 2024
a423aa9
Merge branch 'master' into fast-reload
wcawijngaards Jan 22, 2024
c96debd
Merge branch 'master' into fast-reload
wcawijngaards Jan 22, 2024
b28f671
- fast-reload, fix clang analyzer warnings.
wcawijngaards Jan 23, 2024
b62f8cf
Merge branch 'master' into fast-reload
wcawijngaards Jan 23, 2024
3907d00
Merge branch 'master' into fast-reload
wcawijngaards Feb 15, 2024
0b79daf
- fast-reload, small documentation entry in unbound-control -h output.
wcawijngaards Feb 15, 2024
d047c3f
- fast-reload, printout memory use by fast reload, in bytes.
wcawijngaards Mar 19, 2024
b3dbb62
Merge branch 'master' into fast-reload
wcawijngaards Mar 19, 2024
d915c4c
- fast-reload, compile without threads.
wcawijngaards Mar 21, 2024
bebce30
- fast-reload, document fast_reload in man page.
wcawijngaards Mar 21, 2024
942dd56
- fast-reload, print ok when done successfully.
wcawijngaards Mar 21, 2024
2ab619f
- fast-reload, option for fast-reload commandline, +v verbosity option,
wcawijngaards Mar 21, 2024
c97f5a6
- fast-reload, option for fast-reload commandline, +p does not pause …
wcawijngaards Mar 21, 2024
123205c
- fast-reload, option for fast-reload commandline, +d drops mesh quer…
wcawijngaards Mar 21, 2024
46bdbc7
- fast-reload, fix to poll every thread with nopause to make certain …
wcawijngaards Mar 21, 2024
58ff34c
- fast-reload, fix to use atomic store for config variables with nopa…
wcawijngaards Mar 21, 2024
1aa9800
- fast-reload, reload views.
wcawijngaards Apr 5, 2024
3c33eef
Merge branch 'master' into fast-reload
wcawijngaards Apr 5, 2024
cd33d21
- fast-reload, when tag defines are different, it drops the queries.
wcawijngaards Apr 5, 2024
d9cfc8d
- fast-reload, fix tag define check.
wcawijngaards Apr 5, 2024
3c3fa03
Merge branch 'master' into fast-reload
wcawijngaards Apr 5, 2024
d52018a
- fast-reload, document that tag change causes drop of queries.
wcawijngaards Apr 5, 2024
f06b1c1
- fast-reload, fix space in documentation man page.
wcawijngaards Apr 8, 2024
10b752f
Merge branch 'master' into fast-reload-option
wcawijngaards Apr 8, 2024
4067473
- fast-reload, copy respip client information to query state, put vie…
wcawijngaards Apr 8, 2024
fff0042
- fast-reload, nicer respip view comparison.
wcawijngaards Apr 9, 2024
22e5c7d
- fast-reload, respip global set is in module env.
wcawijngaards Apr 9, 2024
5606d61
- fast-reload, document that respip_client_info acl info is copied.
wcawijngaards Apr 9, 2024
dabe816
- fast-reload, reload the respip_set.
wcawijngaards Apr 9, 2024
2e975d7
- fast-reload, document no pause and pick up of use_response_ip boolean.
wcawijngaards Apr 9, 2024
609434a
- fast-reload, fix test compile.
wcawijngaards Apr 9, 2024
0637df2
- fast-reload, reload local zones.
wcawijngaards May 1, 2024
770aec6
Update locking management for iter_fwd and iter_hints methods. (#1054)
gthess Apr 25, 2024
1ccdd3b
Merge branch 'master' into fast-reload-option
wcawijngaards May 1, 2024
2747f4a
- fast-reload, reload access-control.
wcawijngaards May 6, 2024
1550720
- fast-reload, reload access control interface, such as interface-act…
wcawijngaards May 6, 2024
6b6d706
- fast-reload, reload tcp-connection-limit.
wcawijngaards May 6, 2024
c31a40d
- fast-reload, improve comments on acl_list and tcl_list swap tree.
wcawijngaards May 6, 2024
1c4c3ad
- fast-reload, fixup references to old tcp connection limits in open tcp
wcawijngaards May 6, 2024
1c8448d
- fast-reload, fixup to clean tcp connection also for different linke…
wcawijngaards May 6, 2024
48a3914
- fast-reload, if no tcp connection limits existed, no need to remove
wcawijngaards May 6, 2024
9d85ae0
- fast-reload, document more options that work and do not work.
wcawijngaards May 7, 2024
69b4974
- fast-reload, reload auth_zone and rpz data.
wcawijngaards May 16, 2024
b397597
Merge branch 'master' into fast-reload-option
wcawijngaards May 16, 2024
d819c78
- fast-reload, fix auth_zones_get_mem.
wcawijngaards May 16, 2024
309346e
- fast-reload, fix compilation of testbound for the new comm_timer_ge…
wcawijngaards May 16, 2024
b1ff45a
- fast-reload, change use_rpz with reload.
wcawijngaards May 17, 2024
287d1d2
Merge branch 'master' into fast-reload-option
wcawijngaards May 17, 2024
0ebd545
- fast-reload, list changes in auth zones and stop zonemd callbacks for
wcawijngaards May 17, 2024
e3dd35d
- fast-reload, note xtree is not swapped, and why it is not swapped.
wcawijngaards Jun 5, 2024
20cdee2
Merge branch 'master' into fast-reload-option
wcawijngaards Jun 5, 2024
2cef002
- fast-reload, for added auth zones, pick up zone transfer and zonemd…
wcawijngaards Jun 5, 2024
ecdb5ba
- fast-reload, unlock xfr when done with transfer pick up.
wcawijngaards Jun 5, 2024
b99f8dd
- fast-reload, unlock z when picking up the xfr for it during transfe…
wcawijngaards Jun 5, 2024
00aa03d
- fast-reload, pick up task changes for added, deleted and modified a…
wcawijngaards Jun 6, 2024
713998f
Merge branch 'master' into fast-reload-option
wcawijngaards Jun 6, 2024
e6b46e9
- fast-reload, remove xfr of auth zone deletion without tasks.
wcawijngaards Jun 6, 2024
d478e0b
Merge branch 'master' into fast-reload-option
wcawijngaards Jun 6, 2024
07b0069
- fast-reload, pick up zone transfer config.
wcawijngaards Jun 11, 2024
2352c0b
Merge branch 'master' into fast-reload-option
wcawijngaards Jun 11, 2024
1c80abd
- fast-reload, the main worker thread picks up the transfer tasks and…
wcawijngaards Jun 11, 2024
e209272
- fast-reload, keep writelock on newzone when auth zone changes.
wcawijngaards Jun 11, 2024
89a1961
- fast-reload, change cachedb_enabled setting.
wcawijngaards Jun 19, 2024
1ecad31
Merge branch 'master' into fast-reload-option
wcawijngaards Jun 19, 2024
ea595e8
- fast-reload, pick up edns-strings config.
wcawijngaards Jun 19, 2024
23436f5
- fast-reload, note that settings are not updated.
wcawijngaards Jun 19, 2024
9946473
- fast-reload, pick up dnstap config.
wcawijngaards Jun 19, 2024
34c1b5e
Merge branch 'master' into fast-reload-option
wcawijngaards Jun 19, 2024
2d419cf
- fast-reload, dnstap options that need to be loaded without +p.
wcawijngaards Jun 19, 2024
70b9949
- fast-reload, fix auth zone reload
wcawijngaards Jun 21, 2024
7a76b69
- fast-reload, remove debug for auth zone test.
wcawijngaards Jun 21, 2024
f0d374d
- fast-reload, fix auth zone reload with zone transfer.
wcawijngaards Jun 21, 2024
613d47b
- fast-reload, fix auth zone reload lock order.
wcawijngaards Jun 21, 2024
9032d1d
- fast-reload, remove debug from fast reload test.
wcawijngaards Jun 21, 2024
6021840
- fast-reload, remove unused function.
wcawijngaards Jun 21, 2024
e8e0300
Merge branch 'master' into fast-reload-option
wcawijngaards Jun 21, 2024
341cbed
- fast-reload, fix the worker trust anchor probe timer lock acquisiti…
wcawijngaards Jun 25, 2024
d1681e5
- fast-reload, reload trust anchors.
wcawijngaards Jun 25, 2024
cc63e1d
- fast-reload, fix trust anchor reload lock on autr global data and test
wcawijngaards Jun 25, 2024
d81cf36
- fast-reload, adjust cache sizes.
wcawijngaards Jun 25, 2024
f08d584
- fast-reload, reload cache sizes when changed.
wcawijngaards Jun 27, 2024
442059e
Merge branch 'master' into fast-reload-option
wcawijngaards Jun 27, 2024
5197487
- fast-reload, reload validator env changes.
wcawijngaards Jun 27, 2024
e598005
- fast-reload, reload mesh changes.
wcawijngaards Jun 27, 2024
798fdf1
Merge branch 'master' into fast-reload-option
wcawijngaards Jun 27, 2024
ca975bd
- fast-reload, check for incompatible changes.
wcawijngaards Jun 27, 2024
d355c6b
- fast-reload, improve error text for incompatible change.
wcawijngaards Jun 27, 2024
1364d2b
- fast-reload, fix check config option compatibility.
wcawijngaards Jun 27, 2024
e841e4b
- fast-reload, improve error text for nopause change.
wcawijngaards Jun 27, 2024
0cccab5
- fast-reload, fix spelling of incompatible options.
wcawijngaards Jun 27, 2024
a4dbc8c
- fast-reload, reload target-fetch-policy, outbound-msg-retry, max-se…
wcawijngaards Jul 2, 2024
199e6d8
Merge branch 'master' into fast-reload-option
wcawijngaards Jul 2, 2024
795b0b2
- fast-reload, check nopause config change for target-fetch-policy.
wcawijngaards Jul 2, 2024
2b2a210
- fast-reload, reload do-not-query-address, private-address and capt-…
wcawijngaards Jul 2, 2024
c7f68d3
- fast-reload, check nopause config change for do-not-query-address,
wcawijngaards Jul 2, 2024
6618777
- fast-reload, check fast reload not possible due to interface and
wcawijngaards Jul 2, 2024
346037a
- fast-reload, reload nat64 settings.
wcawijngaards Jul 2, 2024
fa2da45
- fast-reload, reload settings stored in the infra structure.
wcawijngaards Jul 2, 2024
df15b11
- fast-reload, fix modstack lookup and remove outgoing-range check.
wcawijngaards Jul 2, 2024
9b2d25f
- fast-reload, more explanation for config parse failure.
wcawijngaards Jul 3, 2024
163b748
Merge branch 'master' into fast-reload-option
wcawijngaards Jul 3, 2024
95169cf
- fast-reload, reload worker outside network changes.
wcawijngaards Jul 3, 2024
1dd1860
- fast-reload, detect incompatible changes in network settings.
wcawijngaards Jul 3, 2024
adb9942
fast-reload, commit test files.
wcawijngaards Jul 3, 2024
fcb40cc
Merge branch 'master' into fast-reload-option
wcawijngaards Jul 3, 2024
9973990
Merge branch 'master' into fast-reload-option
wcawijngaards Jul 23, 2024
ce87645
- fast-reload, fix warnings for call types in windows compile.
wcawijngaards Jul 23, 2024
f046ce2
- fast-reload, fix warnings and comm_point_internal for tcp wouldbloc…
wcawijngaards Jul 23, 2024
d7aec6e
Merge branch 'master' into fast-reload-option
wcawijngaards Jul 23, 2024
4578def
Merge branch 'master' into fast-reload-option
wcawijngaards Jul 23, 2024
e8703db
- fast-reload, extend lock checks for repeat thread ids.
wcawijngaards Jul 23, 2024
238d9c6
- fast-reload, additional test cases, cache change and tag changes.
wcawijngaards Jul 24, 2024
8f904f2
Merge branch 'master' into fast-reload-option
wcawijngaards Jul 24, 2024
fb448df
- fast-reload, fix documentation for auth_zone_verify_zonemd_with_key.
wcawijngaards Jul 24, 2024
498e51a
- fast-reload, fix copy_cfg type casts and memory leak on config pars…
wcawijngaards Jul 24, 2024
a00c287
Merge branch 'master' into fast-reload-option
wcawijngaards Aug 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ view.lo view.o: $(srcdir)/services/view.c config.h $(srcdir)/services/view.h $(s
$(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/services/localzone.h $(srcdir)/util/storage/dnstree.h \
$(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/data/msgreply.h \
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \
$(srcdir)/sldns/rrdef.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/config_file.h
$(srcdir)/sldns/rrdef.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/config_file.h $(srcdir)/respip/respip.h
rpz.lo rpz.o: $(srcdir)/services/rpz.c config.h $(srcdir)/services/rpz.h $(srcdir)/services/localzone.h \
$(srcdir)/util/rbtree.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/storage/dnstree.h \
$(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/data/msgreply.h \
Expand Down Expand Up @@ -963,7 +963,7 @@ fptr_wlist.lo fptr_wlist.o: $(srcdir)/util/fptr_wlist.c config.h $(srcdir)/util/
$(srcdir)/validator/val_nsec3.h $(srcdir)/validator/val_sigcrypt.h $(srcdir)/validator/val_kentry.h \
$(srcdir)/validator/val_neg.h $(srcdir)/validator/autotrust.h $(srcdir)/libunbound/libworker.h \
$(srcdir)/libunbound/context.h $(srcdir)/util/alloc.h $(srcdir)/libunbound/unbound-event.h \
$(srcdir)/libunbound/worker.h
$(srcdir)/libunbound/worker.h $(srcdir)/daemon/remote.h
locks.lo locks.o: $(srcdir)/util/locks.c config.h $(srcdir)/util/locks.h $(srcdir)/util/log.h
log.lo log.o: $(srcdir)/util/log.c config.h $(srcdir)/util/log.h $(srcdir)/util/locks.h $(srcdir)/sldns/sbuffer.h
mini_event.lo mini_event.o: $(srcdir)/util/mini_event.c config.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h \
Expand Down Expand Up @@ -1298,7 +1298,10 @@ remote.lo remote.o: $(srcdir)/daemon/remote.c config.h $(srcdir)/daemon/remote.h
$(srcdir)/validator/val_anchor.h $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h \
$(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h $(srcdir)/iterator/iter_delegpt.h \
$(srcdir)/services/outside_network.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/parseutil.h \
$(srcdir)/sldns/wire2str.h $(srcdir)/util/edns.h
$(srcdir)/sldns/wire2str.h $(srcdir)/util/edns.h \
$(srcdir)/util/locks.h $(srcdir)/util/ub_event.h \
$(srcdir)/util/tcp_conn_limit.h $(srcdir)/util/edns.h $(srcdir)/validator/val_neg.h \
$(srcdir)/iterator/iter_utils.h $(srcdir)/iterator/iter_donotq.h $(srcdir)/iterator/iter_priv.h
stats.lo stats.o: $(srcdir)/daemon/stats.c config.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h \
$(srcdir)/libunbound/unbound.h $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
Expand Down
3 changes: 3 additions & 0 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,9 @@
/* Define to 1 if you have the <stdarg.h> header file. */
#undef HAVE_STDARG_H

/* Define to 1 if you have the <stdatomic.h> header file. */
#undef HAVE_STDATOMIC_H

/* Define to 1 if you have the <stdbool.h> header file. */
#undef HAVE_STDBOOL_H

Expand Down
8 changes: 8 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -16090,6 +16090,14 @@ then :

fi

ac_fn_c_check_header_compile "$LINENO" "stdatomic.h" "ac_cv_header_stdatomic_h" "$ac_includes_default
"
if test "x$ac_cv_header_stdatomic_h" = xyes
then :
printf "%s\n" "#define HAVE_STDATOMIC_H 1" >>confdefs.h

fi


# check for types.
# Using own tests for int64* because autoconf builtin only give 32bit.
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ AC_CHECK_HEADERS([netioapi.h],,, [AC_INCLUDES_DEFAULT

# Check for Linux timestamping headers
AC_CHECK_HEADERS([linux/net_tstamp.h],,, [AC_INCLUDES_DEFAULT])
AC_CHECK_HEADERS([stdatomic.h],,, [AC_INCLUDES_DEFAULT])

# check for types.
# Using own tests for int64* because autoconf builtin only give 32bit.
Expand Down
11 changes: 11 additions & 0 deletions daemon/acl_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,3 +823,14 @@ log_acl_action(const char* action, struct sockaddr_storage* addr,
(int)port);
}
}

void acl_list_swap_tree(struct acl_list* acl, struct acl_list* data)
{
/* swap tree and region */
rbtree_type oldtree = acl->tree;
struct regional* oldregion = acl->region;
acl->tree = data->tree;
acl->region = data->region;
data->tree = oldtree;
data->region = oldregion;
}
8 changes: 8 additions & 0 deletions daemon/acl_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,12 @@ const char* acl_access_to_str(enum acl_access acl);
void log_acl_action(const char* action, struct sockaddr_storage* addr,
socklen_t addrlen, enum acl_access acl, struct acl_addr* acladdr);

/**
* Swap internal tree with preallocated entries.
* @param acl: the acl structure.
* @param data: the data structure used to take elements from. This contains
* the old elements on return.
*/
void acl_list_swap_tree(struct acl_list* acl, struct acl_list* data);

#endif /* DAEMON_ACL_LIST_H */
34 changes: 19 additions & 15 deletions daemon/daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,7 @@ daemon_init(void)
return daemon;
}

static int setup_acl_for_ports(struct acl_list* list,
struct listen_port* port_list)
int setup_acl_for_ports(struct acl_list* list, struct listen_port* port_list)
{
struct acl_addr* acl_node;
for(; port_list; port_list=port_list->next) {
Expand Down Expand Up @@ -711,16 +710,16 @@ daemon_fork(struct daemon* daemon)
#endif

log_assert(daemon);
if(!(daemon->views = views_create()))
if(!(daemon->env->views = views_create()))
fatal_exit("Could not create views: out of memory");
/* create individual views and their localzone/data trees */
if(!views_apply_cfg(daemon->views, daemon->cfg))
if(!views_apply_cfg(daemon->env->views, daemon->cfg))
fatal_exit("Could not set up views");

if(!acl_list_apply_cfg(daemon->acl, daemon->cfg, daemon->views))
if(!acl_list_apply_cfg(daemon->acl, daemon->cfg, daemon->env->views))
fatal_exit("Could not setup access control list");
if(!acl_interface_apply_cfg(daemon->acl_interface, daemon->cfg,
daemon->views))
daemon->env->views))
fatal_exit("Could not setup interface control list");
if(!tcl_list_apply_cfg(daemon->tcl, daemon->cfg))
fatal_exit("Could not setup TCP connection limits");
Expand Down Expand Up @@ -756,15 +755,15 @@ daemon_fork(struct daemon* daemon)
fatal_exit("Could not set root or stub hints");

/* process raw response-ip configuration data */
if(!(daemon->respip_set = respip_set_create()))
if(!(daemon->env->respip_set = respip_set_create()))
fatal_exit("Could not create response IP set");
if(!respip_global_apply_cfg(daemon->respip_set, daemon->cfg))
if(!respip_global_apply_cfg(daemon->env->respip_set, daemon->cfg))
fatal_exit("Could not set up response IP set");
if(!respip_views_apply_cfg(daemon->views, daemon->cfg,
if(!respip_views_apply_cfg(daemon->env->views, daemon->cfg,
&have_view_respip_cfg))
fatal_exit("Could not set up per-view response IP sets");
daemon->use_response_ip = !respip_set_is_empty(daemon->respip_set) ||
have_view_respip_cfg;
daemon->use_response_ip = !respip_set_is_empty(
daemon->env->respip_set) || have_view_respip_cfg;

/* setup modules */
daemon_setup_modules(daemon);
Expand Down Expand Up @@ -880,14 +879,18 @@ daemon_cleanup(struct daemon* daemon)
daemon->env->hints = NULL;
local_zones_delete(daemon->local_zones);
daemon->local_zones = NULL;
respip_set_delete(daemon->respip_set);
daemon->respip_set = NULL;
views_delete(daemon->views);
daemon->views = NULL;
respip_set_delete(daemon->env->respip_set);
daemon->env->respip_set = NULL;
views_delete(daemon->env->views);
daemon->env->views = NULL;
if(daemon->env->auth_zones)
auth_zones_cleanup(daemon->env->auth_zones);
/* key cache is cleared by module deinit during next daemon_fork() */
daemon_remote_clear(daemon->rc);
if(daemon->fast_reload_thread)
fast_reload_thread_stop(daemon->fast_reload_thread);
if(daemon->fast_reload_printq_list)
fast_reload_printq_list_delete(daemon->fast_reload_printq_list);
for(i=0; i<daemon->num; i++)
worker_delete(daemon->workers[i]);
free(daemon->workers);
Expand Down Expand Up @@ -941,6 +944,7 @@ daemon_delete(struct daemon* daemon)
listen_desetup_locks();
free(daemon->chroot);
free(daemon->pidfile);
free(daemon->cfgfile);
free(daemon->env);
#ifdef HAVE_SSL
listen_sslctx_delete_ticket_keys();
Expand Down
25 changes: 21 additions & 4 deletions daemon/daemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ struct daemon_remote;
struct respip_set;
struct shm_main_info;
struct cookie_secrets;
struct fast_reload_thread;
struct fast_reload_printq;

#include "dnstap/dnstap_config.h"
#ifdef USE_DNSTAP
Expand Down Expand Up @@ -130,15 +132,11 @@ struct daemon {
struct timeval time_last_stat;
/** time when daemon started */
struct timeval time_boot;
/** views structure containing view tree */
struct views* views;
#ifdef USE_DNSTAP
/** the dnstap environment master value, copied and changed by threads*/
struct dt_env* dtenv;
#endif
struct shm_main_info* shm_info;
/** response-ip set with associated actions and tags. */
struct respip_set* respip_set;
/** some response-ip tags or actions are configured if true */
int use_response_ip;
/** some RPZ policies are configured */
Expand All @@ -151,6 +149,17 @@ struct daemon {
int reuse_cache;
/** the EDNS cookie secrets from the cookie-secret-file */
struct cookie_secrets* cookie_secrets;
/** the fast reload thread, or NULL */
struct fast_reload_thread* fast_reload_thread;
/** the fast reload printq list */
struct fast_reload_printq* fast_reload_printq_list;
/** the fast reload option to drop mesh queries, true if so. */
int fast_reload_drop_mesh;
/** for fast reload, if the tcl, tcp connection limits, has
* changes for workers */
int fast_reload_tcl_has_changes;
/** config file name */
char* cfgfile;
};

/**
Expand Down Expand Up @@ -203,4 +212,12 @@ void daemon_delete(struct daemon* daemon);
*/
void daemon_apply_cfg(struct daemon* daemon, struct config_file* cfg);

/**
* Setup acl list to have entries for the port list.
* @param list: the acl interface
* @param port_list: list of open ports, or none.
* @return false on failure
*/
int setup_acl_for_ports(struct acl_list* list, struct listen_port* port_list);

#endif /* DAEMON_H */
Loading