Hi,

This changes the name of the ospfd control socket to include the rdomain.
It's similar to what bgpd does.

OK?

Remi


Index: ospfd/ospfd.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospfd/ospfd.c,v
retrieving revision 1.98
diff -u -p -r1.98 ospfd.c
--- ospfd/ospfd.c       9 Jul 2018 13:19:46 -0000       1.98
+++ ospfd/ospfd.c       10 Jul 2018 22:24:02 -0000
@@ -119,7 +119,6 @@ main(int argc, char *argv[])
 
        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) {
Index: ospfctl/ospfctl.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospfctl/ospfctl.c,v
retrieving revision 1.64
diff -u -p -r1.64 ospfctl.c
--- ospfctl/ospfctl.c   5 Dec 2016 22:39:25 -0000       1.64
+++ ospfctl/ospfctl.c   10 Jul 2018 21:32:27 -0000
@@ -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':

Reply via email to