diff options
author | remi <remi@cvs.openbsd.org> | 2018-07-11 12:09:35 +0000 |
---|---|---|
committer | remi <remi@cvs.openbsd.org> | 2018-07-11 12:09:35 +0000 |
commit | c41a2183ed1dc7e884d63d63c0d379cbcc9fc5af (patch) | |
tree | 1d454c3e093b5f3eb323017d4e81380134f51f9a | |
parent | 432aa1992d965f62727055afc39f518911efab76 (diff) |
Change the control socket to ospfd.sock.<rdomain>.
ok friehm@ jca@
-rw-r--r-- | usr.sbin/ospfctl/ospfctl.c | 9 | ||||
-rw-r--r-- | 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 <claudio@openbsd.org> @@ -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 <claudio@openbsd.org> @@ -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) { |