From Kapetanakis Giannis, thanks.
ok claudio@
-.\" $OpenBSD: relayctl.8,v 1.32 2015/11/28 01:22:44 gsoares Exp $
+.\" $OpenBSD: relayctl.8,v 1.33 2017/11/29 15:24:50 benno Exp $
.\"
.\" Copyright (c) 2007 - 2013 Reyk Floeter <reyk@openbsd.org>
.\" Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: November 28 2015 $
+.Dd $Mdocdate: November 29 2017 $
.Dt RELAYCTL 8
.Os
.Sh NAME
.Nd control the relay daemon
.Sh SYNOPSIS
.Nm
+.Op Fl s Ar socket
.Ar command
.Op Ar argument ...
.Sh DESCRIPTION
.Xr relayd 8
daemon.
.Pp
+The following options are available:
+.Bl -tag -width Ds
+.It Fl s Ar socket
+Use
+.Ar socket
+instead of the default
+.Pa /var/run/relayd.sock
+to communicate with
+.Xr relayd 8 .
+.El
+.Pp
The following commands are available:
.Bl -tag -width Ds
.It Cm host disable Op Ar name | id
-/* $OpenBSD: relayctl.c,v 1.57 2016/09/03 14:44:21 reyk Exp $ */
+/* $OpenBSD: relayctl.c,v 1.58 2017/11/29 15:24:50 benno Exp $ */
/*
* Copyright (c) 2007 - 2013 Reyk Floeter <reyk@openbsd.org>
{
extern char *__progname;
- fprintf(stderr, "usage: %s command [argument ...]\n", __progname);
+ fprintf(stderr, "usage: %s [-s socket] command [argument ...]\n",
+ __progname);
exit(1);
}
int ctl_sock;
int done = 0;
int n, verbose = 0;
+ int ch;
+ const char *sockname;
+
+ sockname = RELAYD_SOCKET;
+ while ((ch = getopt(argc, argv, "s:")) != -1) {
+ switch (ch) {
+ case 's':
+ sockname = optarg;
+ break;
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+ }
+ argc -= optind;
+ argv += optind;
/* parse options */
- if ((res = parse(argc - 1, argv + 1)) == NULL)
+ if ((res = parse(argc, argv)) == NULL)
exit(1);
/* connect to relayd control socket */
bzero(&sun, sizeof(sun));
sun.sun_family = AF_UNIX;
- (void)strlcpy(sun.sun_path, RELAYD_SOCKET, sizeof(sun.sun_path));
+ if (strlcpy(sun.sun_path, sockname, sizeof(sun.sun_path)) >=
+ sizeof(sun.sun_path))
+ errx(1, "socket `%s' too long", sockname);
reconnect:
if (connect(ctl_sock, (struct sockaddr *)&sun, sizeof(sun)) == -1) {
/* Keep retrying if running in monitor mode */
usleep(100);
goto reconnect;
}
- err(1, "connect: %s", RELAYD_SOCKET);
+ err(1, "connect: %s", sockname);
}
if (pledge("stdio", NULL) == -1)
-/* $OpenBSD: config.c,v 1.35 2017/11/27 23:21:16 claudio Exp $ */
+/* $OpenBSD: config.c,v 1.36 2017/11/29 15:24:50 benno Exp $ */
/*
* Copyright (c) 2011 - 2014 Reyk Floeter <reyk@openbsd.org>
env->sc_conf.interval.tv_usec = 0;
env->sc_conf.prefork_relay = RELAY_NUMPROC;
env->sc_conf.statinterval.tv_sec = RELAY_STATINTERVAL;
+ env->sc_ps->ps_csock.cs_name = RELAYD_SOCKET;
}
ps->ps_what[PROC_PARENT] = CONFIG_ALL;
-/* $OpenBSD: parse.y,v 1.220 2017/11/27 23:21:16 claudio Exp $ */
+/* $OpenBSD: parse.y,v 1.221 2017/11/29 15:24:50 benno Exp $ */
/*
* Copyright (c) 2007 - 2014 Reyk Floeter <reyk@openbsd.org>
AGENTX_SOCKET,
sizeof(conf->sc_conf.snmp_path));
}
+ | SOCKET STRING {
+ conf->sc_ps->ps_csock.cs_name = $2;
+ }
;
trap : /* nothing */ { $$ = 0; }
-/* $OpenBSD: relayd.c,v 1.170 2017/11/27 21:06:26 claudio Exp $ */
+/* $OpenBSD: relayd.c,v 1.171 2017/11/29 15:24:50 benno Exp $ */
/*
* Copyright (c) 2007 - 2016 Reyk Floeter <reyk@openbsd.org>
if ((ps->ps_pw = getpwnam(RELAYD_USER)) == NULL)
errx(1, "unknown user %s", RELAYD_USER);
- /* Configure the control socket */
- ps->ps_csock.cs_name = RELAYD_SOCKET;
-
log_init(debug, LOG_DAEMON);
log_setverbose(verbose);
-.\" $OpenBSD: relayd.conf.5,v 1.180 2017/11/27 23:21:16 claudio Exp $
+.\" $OpenBSD: relayd.conf.5,v 1.181 2017/11/29 15:24:50 benno Exp $
.\"
.\" Copyright (c) 2006 - 2016 Reyk Floeter <reyk@openbsd.org>
.\" Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@openbsd.org>
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: November 27 2017 $
+.Dd $Mdocdate: November 29 2017 $
.Dt RELAYD.CONF 5
.Os
.Sh NAME
See
.Xr snmpd.conf 5
for more information about SNMP configuration.
+.It Ic socket Qo Ar path Qc
+Create a control socket at
+.Ar path .
+By default
+.Pa /var/run/relayd.sock
+is used..
.It Ic timeout Ar number
Set the global timeout in milliseconds for checks.
This can be overridden by the timeout value in the table definitions.