In 2018 we discussed that it is OK when ripd leaves its control socket
laying around:
https://marc.info/?l=openbsd-tech&m=154101413029926&w=2

When mestre@ adapted ldpd in June this year I was reminded to also adapt
ospfd and ospf6d for consistent.

OK?

Remi


Index: ospfd/control.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospfd/control.c,v
retrieving revision 1.45
diff -u -p -r1.45 control.c
--- ospfd/control.c     29 Aug 2018 08:43:16 -0000      1.45
+++ ospfd/control.c     12 Sep 2020 13:13:54 -0000
@@ -125,13 +125,10 @@ control_listen(void)
 }
 
 void
-control_cleanup(char *path)
+control_cleanup(void)
 {
-       if (path == NULL)
-               return;
        event_del(&control_state.ev);
        event_del(&control_state.evt);
-       unlink(path);
 }
 
 /* ARGSUSED */
Index: ospfd/control.h
===================================================================
RCS file: /cvs/src/usr.sbin/ospfd/control.h,v
retrieving revision 1.7
diff -u -p -r1.7 control.h
--- ospfd/control.h     29 Aug 2018 08:43:16 -0000      1.7
+++ ospfd/control.h     12 Sep 2020 13:14:15 -0000
@@ -40,6 +40,6 @@ int   control_listen(void);
 void   control_accept(int, short, void *);
 void   control_dispatch_imsg(int, short, void *);
 int    control_imsg_relay(struct imsg *);
-void   control_cleanup(char *);
+void   control_cleanup(void);
 
 #endif /* _CONTROL_H_ */
Index: ospfd/ospfd.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospfd/ospfd.c,v
retrieving revision 1.113
diff -u -p -r1.113 ospfd.c
--- ospfd/ospfd.c       26 Jun 2020 19:04:38 -0000      1.113
+++ ospfd/ospfd.c       12 Sep 2020 13:14:42 -0000
@@ -282,8 +282,6 @@ main(int argc, char *argv[])
 
        if (unveil("/", "r") == -1)
                fatal("unveil");
-       if (unveil(ospfd_conf->csock, "c") == -1)
-               fatal("unveil");
        if (unveil(NULL, NULL) == -1)
                fatal("unveil");
 
@@ -318,7 +316,7 @@ ospfd_shutdown(void)
        msgbuf_clear(&iev_rde->ibuf.w);
        close(iev_rde->ibuf.fd);
 
-       control_cleanup(ospfd_conf->csock);
+       control_cleanup();
        while ((r = SIMPLEQ_FIRST(&ospfd_conf->redist_list)) != NULL) {
                SIMPLEQ_REMOVE_HEAD(&ospfd_conf->redist_list, entry);
                free(r);
Index: ospf6d/control.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospf6d/control.c,v
retrieving revision 1.28
diff -u -p -r1.28 control.c
--- ospf6d/control.c    1 Jan 2020 10:09:34 -0000       1.28
+++ ospf6d/control.c    12 Sep 2020 13:29:06 -0000
@@ -124,13 +124,10 @@ control_listen(void)
 }
 
 void
-control_cleanup(char *path)
+control_cleanup(void)
 {
-       if (path == NULL)
-               return;
        event_del(&control_state.ev);
        event_del(&control_state.evt);
-       unlink(path);
 }
 
 /* ARGSUSED */
Index: ospf6d/control.h
===================================================================
RCS file: /cvs/src/usr.sbin/ospf6d/control.h,v
retrieving revision 1.6
diff -u -p -r1.6 control.h
--- ospf6d/control.h    1 Sep 2018 19:21:10 -0000       1.6
+++ ospf6d/control.h    12 Sep 2020 13:27:50 -0000
@@ -40,6 +40,6 @@ int   control_listen(void);
 void   control_accept(int, short, void *);
 void   control_dispatch_imsg(int, short, void *);
 int    control_imsg_relay(struct imsg *);
-void   control_cleanup(char *);
+void   control_cleanup(void);
 
 #endif /* _CONTROL_H_ */
Index: ospf6d/ospf6d.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospf6d/ospf6d.c,v
retrieving revision 1.47
diff -u -p -r1.47 ospf6d.c
--- ospf6d/ospf6d.c     26 Jun 2020 19:06:52 -0000      1.47
+++ ospf6d/ospf6d.c     12 Sep 2020 13:40:11 -0000
@@ -274,7 +274,8 @@ main(int argc, char *argv[])
                fatalx("control socket setup failed");
        main_imsg_compose_ospfe_fd(IMSG_CONTROLFD, 0, control_fd);
 
-       if (unveil(ospfd_conf->csock, "c") == -1)
+       /* no filesystem visibility */
+       if (unveil("/", "") == -1)
                fatal("unveil");
        if (unveil(NULL, NULL) == -1)
                fatal("unveil");
@@ -303,7 +304,7 @@ ospfd_shutdown(void)
        msgbuf_clear(&iev_rde->ibuf.w);
        close(iev_rde->ibuf.fd);
 
-       control_cleanup(ospfd_conf->csock);
+       control_cleanup();
        kr_shutdown();
        carp_demote_shutdown();
 

Reply via email to