]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon: remove systemd socket activation support
authorTomas Krizek <tomas.krizek@nic.cz>
Wed, 15 Jan 2020 13:16:56 +0000 (14:16 +0100)
committerTomas Krizek <tomas.krizek@nic.cz>
Tue, 21 Jan 2020 16:20:37 +0000 (17:20 +0100)
daemon/main.c
meson.build

index 0b62f60512ec2e06b6fdab936fef703fb4524d5c..d322e22ed83c3c74ee84a62fb66b4d88c6c6e167 100644 (file)
@@ -304,16 +304,6 @@ static int run_worker(uv_loop_t *loop, struct engine *engine, fd_array_t *ipc_se
        return EXIT_SUCCESS;
 }
 
-#if SYSTEMD_VERSION >= 227
-static void free_sd_socket_names(char **socket_names, int count)
-{
-       for (int i = 0; i < count; i++) {
-               free(socket_names[i]);
-       }
-       free(socket_names);
-}
-#endif
-
 static void args_init(struct args *args)
 {
        memset(args, 0, sizeof(struct args));
@@ -546,55 +536,6 @@ int main(int argc, char **argv)
        ret = bind_sockets(&the_args->addrs_tls, true, &the_args->fds);
        if (ret) goto cleanup_args;
 
-#if SYSTEMD_VERSION >= 227
-       /* Accept passed sockets from systemd supervisor. */
-       char **socket_names = NULL;
-       int sd_nsocks = sd_listen_fds_with_names(0, &socket_names);
-       if (sd_nsocks < 0) {
-               kr_log_error("[system] failed passing sockets from systemd: %s\n",
-                            kr_strerror(sd_nsocks));
-               free_sd_socket_names(socket_names, sd_nsocks);
-               ret = EXIT_FAILURE;
-               goto cleanup_args;
-       }
-       if (sd_nsocks > 0 && the_args->forks != 1) {
-               kr_log_error("[system] when run under systemd-style supervision, "
-                            "use single-process only (bad: --forks=%d).\n", the_args->forks);
-               free_sd_socket_names(socket_names, sd_nsocks);
-               ret = EXIT_FAILURE;
-               goto cleanup_args;
-       }
-       for (int i = 0; i < sd_nsocks; ++i) {
-               /* when run under systemd supervision, do not use interactive mode */
-               the_args->interactive = false;
-               flagged_fd_t ffd = { .fd = SD_LISTEN_FDS_START + i };
-
-               if (!strcasecmp("control", socket_names[i])) {
-                       if (the_args->control_fd != -1) {
-                               kr_log_error("[system] multiple control sockets passed from systemd\n");
-                               ret = EXIT_FAILURE;
-                               break;
-                       }
-                       the_args->control_fd = ffd.fd;
-                       free(socket_names[i]);
-               } else {
-                       if (!strcasecmp("dns", socket_names[i])) {
-                               free(socket_names[i]);
-                       } else if (!strcasecmp("tls", socket_names[i])) {
-                               ffd.flags.tls = true;
-                               free(socket_names[i]);
-                       } else {
-                               ffd.flags.kind = socket_names[i];
-                       }
-                       array_push(the_args->fds, ffd);
-               }
-               /* Either freed or passed ownership. */
-               socket_names[i] = NULL;
-       }
-       free_sd_socket_names(socket_names, sd_nsocks);
-       if (ret) goto cleanup_args;
-#endif
-
        /* Switch to rundir. */
        if (the_args->rundir != NULL) {
                /* FIXME: access isn't a good way if we start as root and drop privileges later */
index 9527acafae66e8c5f3b30b160c0ec751d1c41e12..7e1b3cd7b6efbc8ab8ba2280c047b6441b88608f 100644 (file)
@@ -98,12 +98,8 @@ else
 endif
 
 ### Systemd
-libsystemd = dependency('libsystemd', required: false)
 systemd_files = get_option('systemd_files')
-if systemd_files == 'enabled' and (
-    not libsystemd.found() or libsystemd.version().version_compare('<227'))
-  error('systemd_files=enabled requires libsystemd >= 227')
-endif
+libsystemd = dependency('libsystemd', required: systemd_files == 'enabled')
 message('---------------------------')
 
 ## Compiler args
@@ -257,7 +253,6 @@ run_target(
 # https://github.com/mesonbuild/meson/issues/2404
 s_managed_ta = managed_ta ? 'enabled' : 'disabled'
 s_install_root_keys = install_root_keys ? 'enabled' : 'disabled'
-s_systemd_socket = libsystemd.found() ? 'enabled' : 'disabled'
 s_build_client = build_client ? 'enabled' : 'disabled'
 s_build_utils = build_utils ? 'enabled' : 'disabled'
 s_build_dnstap = build_dnstap ? 'enabled' : 'disabled'
@@ -284,7 +279,6 @@ message('''
     install_root_keys:  @0@'''.format(s_install_root_keys) + '''
 
   systemd:
-    socket activation:  @0@'''.format(s_systemd_socket) + '''
     files:              @0@'''.format(systemd_files) + '''
     work_dir:           @0@'''.format(systemd_work_dir) + '''