1 From 3c973ad92d317df736d5a8fde67baba6b102d91e Mon Sep 17 00:00:00 2001
2 From: Simon Kelley <simon@thekelleys.org.uk>
3 Date: Sun, 14 Jan 2018 21:05:37 +0000
4 Subject: [PATCH] Use SIGINT (instead of overloading SIGHUP) to turn on DNSSEC
8 src/dnsmasq.c | 36 +++++++++++++++++++++++++-----------
11 5 files changed, 38 insertions(+), 14 deletions(-)
15 @@ -137,7 +137,8 @@ int main (int argc, char **argv)
16 sigaction(SIGTERM, &sigact, NULL);
17 sigaction(SIGALRM, &sigact, NULL);
18 sigaction(SIGCHLD, &sigact, NULL);
20 + sigaction(SIGINT, &sigact, NULL);
23 sigact.sa_handler = SIG_IGN;
24 sigaction(SIGPIPE, &sigact, NULL);
25 @@ -815,7 +816,7 @@ int main (int argc, char **argv)
27 daemon->dnssec_no_time_check = option_bool(OPT_DNSSEC_TIME);
28 if (option_bool(OPT_DNSSEC_TIME) && !daemon->back_to_the_future)
29 - my_syslog(LOG_INFO, _("DNSSEC signature timestamps not checked until first cache reload"));
30 + my_syslog(LOG_INFO, _("DNSSEC signature timestamps not checked until receipt of SIGINT"));
33 my_syslog(LOG_INFO, _("DNSSEC signature timestamps not checked until system time valid"));
34 @@ -1142,7 +1143,7 @@ static void sig_handler(int sig)
36 /* ignore anything other than TERM during startup
37 and in helper proc. (helper ignore TERM too) */
39 + if (sig == SIGTERM || sig == SIGINT)
42 else if (pid != getpid())
43 @@ -1168,6 +1169,15 @@ static void sig_handler(int sig)
45 else if (sig == SIGUSR2)
47 + else if (sig == SIGINT)
49 + /* Handle SIGINT normally in debug mode, so
50 + ctrl-c continues to operate. */
51 + if (option_bool(OPT_DEBUG))
59 @@ -1295,14 +1305,7 @@ static void async_event(int pipe, time_t
62 daemon->soa_sn++; /* Bump zone serial, as it may have changed. */
65 - if (daemon->dnssec_no_time_check && option_bool(OPT_DNSSEC_VALID) && option_bool(OPT_DNSSEC_TIME))
67 - my_syslog(LOG_INFO, _("now checking DNSSEC signature timestamps"));
68 - daemon->dnssec_no_time_check = 0;
75 @@ -1411,6 +1414,17 @@ static void async_event(int pipe, time_t
76 poll_resolv(0, 1, now);
81 + if (daemon->dnssec_no_time_check && option_bool(OPT_DNSSEC_VALID) && option_bool(OPT_DNSSEC_TIME))
83 + my_syslog(LOG_INFO, _("now checking DNSSEC signature timestamps"));
84 + daemon->dnssec_no_time_check = 0;
85 + clear_cache_and_reload(now);
91 /* Knock all our children on the head. */
92 for (i = 0; i < MAX_PROCS; i++)
95 @@ -175,6 +175,7 @@ struct event_desc {
96 #define EVENT_NEWROUTE 23
97 #define EVENT_TIME_ERR 24
98 #define EVENT_SCRIPT_LOG 25
99 +#define EVENT_TIME 26
105 @@ -97,13 +97,14 @@ int create_helper(int event_fd, int err_
109 - /* ignore SIGTERM, so that we can clean up when the main process gets hit
110 + /* ignore SIGTERM and SIGINT, so that we can clean up when the main process gets hit
111 and SIGALRM so that we can use sleep() */
112 sigact.sa_handler = SIG_IGN;
114 sigemptyset(&sigact.sa_mask);
115 sigaction(SIGTERM, &sigact, NULL);
116 sigaction(SIGALRM, &sigact, NULL);
117 + sigaction(SIGINT, &sigact, NULL);
119 if (!option_bool(OPT_DEBUG) && uid != 0)