Hello,

I'm using pair of OpenBSD routers with several isakmpd daemons running
in different rdomains synchronizing SA database with sasyncd.
Currently sasyncd works only with default isakmpd FIFO path. The
following patch will fix this issue:

Index: monitor.c
===================================================================
RCS file: /cvs/src/usr.sbin/sasyncd/monitor.c,v
retrieving revision 1.22
diff -u -p -u -r1.22 monitor.c
--- monitor.c 21 May 2017 02:37:52 -0000 1.22
+++ monitor.c 29 Oct 2018 05:50:24 -0000
@@ -65,6 +65,8 @@ static int m_priv_control_passivate(void
 static ssize_t m_write(int, void *, size_t);
 static ssize_t m_read(int, void *, size_t);

+char *isakmpd_fifo = "/var/run/isakmpd.fifo";
+
 pid_t
 monitor_init(void)
 {
@@ -440,16 +442,16 @@ m_priv_isakmpd_fifocmd(const char *cmd)
  struct stat sb;
  int fd = -1, ret = -1;

- if ((fd = open(ISAKMPD_FIFO, O_WRONLY)) == -1) {
- log_err("m_priv_isakmpd_fifocmd: open(%s)", ISAKMPD_FIFO);
+ if ((fd = open(isakmpd_fifo, O_WRONLY)) == -1) {
+ log_err("m_priv_isakmpd_fifocmd: open(%s)", isakmpd_fifo);
  goto out;
  }
  if (fstat(fd, &sb) == -1) {
- log_err("m_priv_isakmpd_fifocmd: fstat(%s)", ISAKMPD_FIFO);
+ log_err("m_priv_isakmpd_fifocmd: fstat(%s)", isakmpd_fifo);
  goto out;
  }
  if (!S_ISFIFO(sb.st_mode)) {
- log_err("m_priv_isakmpd_fifocmd: %s not a fifo", ISAKMPD_FIFO);
+ log_err("m_priv_isakmpd_fifocmd: %s not a fifo", isakmpd_fifo);
  goto out;
  }

Index: monitor.h
===================================================================
RCS file: /cvs/src/usr.sbin/sasyncd/monitor.h,v
retrieving revision 1.2
diff -u -p -u -r1.2 monitor.h
--- monitor.h 16 Jun 2010 17:39:05 -0000 1.2
+++ monitor.h 29 Oct 2018 05:50:24 -0000
@@ -33,8 +33,6 @@

 #define MONITOR_RETRY_TIMEOUT 4

-#define ISAKMPD_FIFO "/var/run/isakmpd.fifo"
-
 pid_t monitor_init(void);
 void monitor_loop(void);

Index: sasyncd.8
===================================================================
RCS file: /cvs/src/usr.sbin/sasyncd/sasyncd.8,v
retrieving revision 1.12
diff -u -p -u -r1.12 sasyncd.8
--- sasyncd.8 4 Apr 2017 22:37:01 -0000 1.12
+++ sasyncd.8 29 Oct 2018 05:50:24 -0000
@@ -37,6 +37,7 @@
 .Nm
 .Op Fl dnv
 .Op Fl c Ar config-file
+.Op Fl i Ar fifo
 .Sh DESCRIPTION
 The
 .Nm
@@ -109,6 +110,13 @@ If given, the
 .Fl c
 option specifies an alternate configuration file instead of
 .Pa /etc/sasyncd.conf .
+.It Fl i Ar fifo
+If given, the
+.Fl i
+option specifies an alternate FIFO instead of
+.Pa /var/run/isakmpd.fifo ,
+used to talk to
+.Xr isakmpd 8 .
 .It Fl d
 The
 .Fl d
Index: sasyncd.c
===================================================================
RCS file: /cvs/src/usr.sbin/sasyncd/sasyncd.c,v
retrieving revision 1.28
diff -u -p -u -r1.28 sasyncd.c
--- sasyncd.c 10 Apr 2018 15:58:21 -0000 1.28
+++ sasyncd.c 29 Oct 2018 05:50:24 -0000
@@ -136,7 +136,8 @@ usage(void)
 {
  extern char *__progname;

- fprintf(stderr, "usage: %s [-dnv] [-c config-file]\n", __progname);
+ fprintf(stderr, "usage: %s [-dnv] [-c config-file] [-i fifo]\n",
+    __progname);
  exit(1);
 }

@@ -154,7 +155,7 @@ main(int argc, char **argv)
  return 1;
  }

- while ((ch = getopt(argc, argv, "c:dnv")) != -1) {
+ while ((ch = getopt(argc, argv, "c:di:nv")) != -1) {
  switch (ch) {
  case 'c':
  if (cfgfile)
@@ -163,6 +164,9 @@ main(int argc, char **argv)
  break;
  case 'd':
  cfgstate.debug++;
+ break;
+ case 'i':
+ isakmpd_fifo = optarg;
  break;
  case 'n':
  noaction = 1;
Index: sasyncd.h
===================================================================
RCS file: /cvs/src/usr.sbin/sasyncd/sasyncd.h,v
retrieving revision 1.19
diff -u -p -u -r1.19 sasyncd.h
--- sasyncd.h 10 Apr 2018 15:58:21 -0000 1.19
+++ sasyncd.h 29 Oct 2018 05:50:24 -0000
@@ -142,6 +142,7 @@ void log_err(const char *, ...)
  __attribute__((__format__ (printf, 1, 2)));

 /* monitor.c */
+extern char *isakmpd_fifo;
 pid_t monitor_init(void);
 void monitor_loop(void);
 void monitor_carpdemote(void *);

-- 
Pozdrawiam, Bartosz Kuźma.

Reply via email to