-/* $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>
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':
-/* $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>
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]);
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) {