summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ospfd
diff options
context:
space:
mode:
authorremi <remi@openbsd.org>2018-07-11 12:09:34 +0000
committerremi <remi@openbsd.org>2018-07-11 12:09:34 +0000
commitec107b41ef0d619a5bb1f26425c4e43be2dde511 (patch)
treef7db4de05a47509e1df35452393ae9ca4bf4e7ce /usr.sbin/ospfd
parentAfter opening all the needed files, tighten the pledge(2) (diff)
downloadwireguard-openbsd-ec107b41ef0d619a5bb1f26425c4e43be2dde511.tar.xz
wireguard-openbsd-ec107b41ef0d619a5bb1f26425c4e43be2dde511.zip
Change the control socket to ospfd.sock.<rdomain>.
ok friehm@ jca@
Diffstat (limited to 'usr.sbin/ospfd')
-rw-r--r--usr.sbin/ospfd/ospfd.c12
1 files changed, 9 insertions, 3 deletions
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) {