-/* $OpenBSD: eigrpd.c,v 1.27 2019/03/31 03:36:18 yasuoka Exp $ */
+/* $OpenBSD: eigrpd.c,v 1.28 2021/01/19 10:53:25 claudio Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
int pipe_parent2rde[2];
conffile = CONF_FILE;
- eigrpd_process = PROC_MAIN;
- log_procname = log_procnames[eigrpd_process];
+ log_procname = "parent";
sockname = EIGRPD_SOCKET;
log_init(1); /* log to stderr until daemonized */
close(iev_rde->ibuf.fd);
kr_shutdown();
- config_clear(eigrpd_conf);
+ config_clear(eigrpd_conf, PROC_MAIN);
log_debug("waiting for children to terminate");
do {
if (main_imsg_send_config(xconf) == -1)
return (-1);
- merge_config(eigrpd_conf, xconf);
+ merge_config(eigrpd_conf, xconf, PROC_MAIN);
return (0);
}
}
void
-merge_config(struct eigrpd_conf *conf, struct eigrpd_conf *xconf)
+merge_config(struct eigrpd_conf *conf, struct eigrpd_conf *xconf,
+ enum eigrpd_process proc)
{
struct iface *iface, *itmp, *xi;
struct eigrp *eigrp, *etmp, *xe;
if ((xe = eigrp_find(xconf, eigrp->af, eigrp->as)) == NULL) {
TAILQ_REMOVE(&conf->instances, eigrp, entry);
- switch (eigrpd_process) {
+ switch (proc) {
case PROC_RDE_ENGINE:
rde_instance_del(eigrp);
break;
TAILQ_REMOVE(&xconf->instances, xe, entry);
TAILQ_INSERT_TAIL(&conf->instances, xe, entry);
- switch (eigrpd_process) {
+ switch (proc) {
case PROC_RDE_ENGINE:
rde_instance_init(xe);
break;
}
/* resend addresses to activate new interfaces */
- if (eigrpd_process == PROC_MAIN)
+ if (proc == PROC_MAIN)
kif_redistribute();
free(xconf);
}
void
-config_clear(struct eigrpd_conf *conf)
+config_clear(struct eigrpd_conf *conf, enum eigrpd_process proc)
{
struct eigrpd_conf *xconf;
/* merge current config with an empty config */
xconf = config_new_empty();
- merge_config(conf, xconf);
+ merge_config(conf, xconf, proc);
free(conf);
}
-/* $OpenBSD: eigrpd.h,v 1.25 2018/08/05 08:10:35 mestre Exp $ */
+/* $OpenBSD: eigrpd.h,v 1.26 2021/01/19 10:53:25 claudio Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
#define F_CTL_ACTIVE 0x0400
#define F_CTL_ALLLINKS 0x0800
-static const char * const log_procnames[] = {
- "parent",
- "eigrpe",
- "rde"
-};
-
struct imsgev {
struct imsgbuf ibuf;
void (*handler)(int, short, void *);
PROC_MAIN,
PROC_EIGRP_ENGINE,
PROC_RDE_ENGINE
-} eigrpd_process;
+};
struct eigrpd_conf {
struct in_addr rtr_id;
int imsg_compose_event(struct imsgev *, uint16_t, uint32_t,
pid_t, int, void *, uint16_t);
struct eigrp *eigrp_find(struct eigrpd_conf *, int, uint16_t);
-void merge_config(struct eigrpd_conf *, struct eigrpd_conf *);
+void merge_config(struct eigrpd_conf *, struct eigrpd_conf *,
+ enum eigrpd_process);
struct eigrpd_conf *config_new_empty(void);
-void config_clear(struct eigrpd_conf *);
+void config_clear(struct eigrpd_conf *, enum eigrpd_process);
/* printconf.c */
void print_config(struct eigrpd_conf *);
-/* $OpenBSD: eigrpe.c,v 1.38 2021/01/19 10:37:25 claudio Exp $ */
+/* $OpenBSD: eigrpe.c,v 1.39 2021/01/19 10:53:25 claudio Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
fatal("chdir(\"/\")");
setproctitle("eigrp engine");
- eigrpd_process = PROC_EIGRP_ENGINE;
- log_procname = log_procnames[eigrpd_process];
+ log_procname = "eigrpe";
if (setgroups(1, &pw->pw_gid) ||
setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) ||
msgbuf_clear(&iev_main->ibuf.w);
close(iev_main->ibuf.fd);
- config_clear(econf);
+ config_clear(econf, PROC_EIGRP_ENGINE);
event_del(&ev4);
event_del(&ev6);
"RB_INSERT(ifaces_by_id) failed");
break;
case IMSG_RECONF_END:
- merge_config(econf, nconf);
+ merge_config(econf, nconf, PROC_EIGRP_ENGINE);
nconf = NULL;
break;
case IMSG_CTL_KROUTE:
-/* $OpenBSD: rde.c,v 1.23 2016/09/02 16:46:29 renato Exp $ */
+/* $OpenBSD: rde.c,v 1.24 2021/01/19 10:53:25 claudio Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
fatal("chdir(\"/\")");
setproctitle("route decision engine");
- eigrpd_process = PROC_RDE_ENGINE;
+ log_procname = "rde";
if (setgroups(1, &pw->pw_gid) ||
setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) ||
msgbuf_clear(&iev_main->ibuf.w);
close(iev_main->ibuf.fd);
- config_clear(rdeconf);
+ config_clear(rdeconf, PROC_RDE_ENGINE);
free(iev_eigrpe);
free(iev_main);
"RB_INSERT(ifaces_by_id) failed");
break;
case IMSG_RECONF_END:
- merge_config(rdeconf, nconf);
+ merge_config(rdeconf, nconf, PROC_RDE_ENGINE);
nconf = NULL;
break;
default: