-/* $OpenBSD: engine.c,v 1.57 2020/10/30 18:30:26 florian Exp $ */
+/* $OpenBSD: engine.c,v 1.58 2021/01/19 16:48:20 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
if (chdir("/") == -1)
fatal("chdir(\"/\")");
- slaacd_process = PROC_ENGINE;
- setproctitle("%s", log_procnames[slaacd_process]);
- log_procinit(log_procnames[slaacd_process]);
+ setproctitle("%s", "engine");
+ log_procinit("engine");
if (setgroups(1, &pw->pw_gid) ||
setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) ||
-/* $OpenBSD: frontend.c,v 1.46 2021/01/17 15:39:17 florian Exp $ */
+/* $OpenBSD: frontend.c,v 1.47 2021/01/19 16:48:20 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
if (chdir("/") == -1)
fatal("chdir(\"/\")");
- slaacd_process = PROC_FRONTEND;
- setproctitle("%s", log_procnames[slaacd_process]);
- log_procinit(log_procnames[slaacd_process]);
+ setproctitle("%s", "frontend");
+ log_procinit("frontend");
if ((ioctlsock = socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0)) == -1)
fatal("socket");
-/* $OpenBSD: slaacd.c,v 1.54 2021/01/17 15:39:17 florian Exp $ */
+/* $OpenBSD: slaacd.c,v 1.55 2021/01/19 16:48:20 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
#include "engine.h"
#include "control.h"
+enum slaacd_process {
+ PROC_MAIN,
+ PROC_ENGINE,
+ PROC_FRONTEND
+};
+
__dead void usage(void);
__dead void main_shutdown(void);
void main_sig_handler(int, short, void *);
-static pid_t start_child(int, char *, int, int, int);
+static pid_t start_child(enum slaacd_process, char *, int, int, int);
void main_dispatch_frontend(int, short, void *);
void main_dispatch_engine(int, short, void *);
frontend_pid = start_child(PROC_FRONTEND, saved_argv0,
pipe_main2frontend[1], debug, verbose);
- slaacd_process = PROC_MAIN;
-
- log_procinit(log_procnames[slaacd_process]);
+ log_procinit("main");
if ((routesock = socket(AF_ROUTE, SOCK_RAW | SOCK_CLOEXEC |
SOCK_NONBLOCK, AF_INET6)) == -1)
}
static pid_t
-start_child(int p, char *argv0, int fd, int debug, int verbose)
+start_child(enum slaacd_process p, char *argv0, int fd, int debug, int verbose)
{
char *argv[7];
int argc = 0;
-/* $OpenBSD: slaacd.h,v 1.27 2020/09/14 09:07:05 florian Exp $ */
+/* $OpenBSD: slaacd.h,v 1.28 2021/01/19 16:48:20 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
#define IMSG_DATA_SIZE(imsg) ((imsg).hdr.len - IMSG_HEADER_SIZE)
-static const char * const log_procnames[] = {
- "main",
- "engine",
- "frontend"
-};
-
struct imsgev {
struct imsgbuf ibuf;
void (*handler)(int, short, void *);
IMSG_DUP_ADDRESS,
};
-enum {
- PROC_MAIN,
- PROC_ENGINE,
- PROC_FRONTEND
-} slaacd_process;
-
enum rpref {
LOW,
MEDIUM,