From ec107b41ef0d619a5bb1f26425c4e43be2dde511 Mon Sep 17 00:00:00 2001 From: remi Date: Wed, 11 Jul 2018 12:09:34 +0000 Subject: [PATCH] Change the control socket to ospfd.sock.. ok friehm@ jca@ --- usr.sbin/ospfctl/ospfctl.c | 9 ++++++--- usr.sbin/ospfd/ospfd.c | 12 +++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/usr.sbin/ospfctl/ospfctl.c b/usr.sbin/ospfctl/ospfctl.c index 4d0f05152d8..9ee92aa743c 100644 --- a/usr.sbin/ospfctl/ospfctl.c +++ b/usr.sbin/ospfctl/ospfctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfctl.c,v 1.64 2016/12/05 22:39:25 jca Exp $ */ +/* $OpenBSD: ospfctl.c,v 1.65 2018/07/11 12:09:34 remi Exp $ */ /* * Copyright (c) 2005 Claudio Jeker @@ -89,13 +89,16 @@ main(int argc, char *argv[]) struct parse_result *res; struct imsg imsg; unsigned int ifidx = 0; - int ctl_sock; + int ctl_sock, r; int done = 0; int n, verbose = 0; int ch; char *sockname; - sockname = OSPFD_SOCKET; + r = getrtable(); + if (asprintf(&sockname, "%s.%d", OSPFD_SOCKET, r) == -1) + err(1, "asprintf"); + while ((ch = getopt(argc, argv, "s:")) != -1) { switch (ch) { case 's': diff --git a/usr.sbin/ospfd/ospfd.c b/usr.sbin/ospfd/ospfd.c index b3a91726075..378bc2bfbb0 100644 --- a/usr.sbin/ospfd/ospfd.c +++ b/usr.sbin/ospfd/ospfd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfd.c,v 1.98 2018/07/09 13:19:46 remi Exp $ */ +/* $OpenBSD: ospfd.c,v 1.99 2018/07/11 12:09:34 remi Exp $ */ /* * Copyright (c) 2005 Claudio Jeker @@ -115,11 +115,10 @@ main(int argc, char *argv[]) int ipforwarding; int mib[4]; size_t len; - char *sockname; + char *sockname = NULL; conffile = CONF_FILE; ospfd_process = PROC_MAIN; - sockname = OSPFD_SOCKET; log_init(1, LOG_DAEMON); /* log to stderr until daemonized */ log_procinit(log_procnames[ospfd_process]); @@ -185,6 +184,13 @@ main(int argc, char *argv[]) kif_clear(); exit(1); } + + if (sockname == NULL) { + if (asprintf(&sockname, "%s.%d", OSPFD_SOCKET, + ospfd_conf->rdomain) == -1) + err(1, "asprintf"); + } + ospfd_conf->csock = sockname; if (ospfd_conf->opts & OSPFD_OPT_NOACTION) { -- 2.20.1