summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorRenato Westphal <renato@cvs.openbsd.org>2017-02-22 14:18:26 +0000
committerRenato Westphal <renato@cvs.openbsd.org>2017-02-22 14:18:26 +0000
commit04b9e1b5fd06f054e918d307176c342c041a65f7 (patch)
tree52829a17c9209ebf8d2d87526e60fdb06cf2d544 /usr.sbin
parentbc5184a90bab058498cba3ecbabc6e45af0d115a (diff)
Allow specifying an alternate socket path.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/eigrpctl/eigrpctl.816
-rw-r--r--usr.sbin/eigrpctl/eigrpctl.c27
2 files changed, 36 insertions, 7 deletions
diff --git a/usr.sbin/eigrpctl/eigrpctl.8 b/usr.sbin/eigrpctl/eigrpctl.8
index 7137a4b7123..89c5e729356 100644
--- a/usr.sbin/eigrpctl/eigrpctl.8
+++ b/usr.sbin/eigrpctl/eigrpctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: eigrpctl.8,v 1.5 2016/01/15 12:57:48 renato Exp $
+.\" $OpenBSD: eigrpctl.8,v 1.6 2017/02/22 14:18:25 renato Exp $
.\"
.\" Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
.\" Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: January 15 2016 $
+.Dd $Mdocdate: February 22 2017 $
.Dt EIGRPCTL 8
.Os
.Sh NAME
@@ -23,6 +23,7 @@
.Nd control the Enhanced Interior Gateway Routing Protocol daemon
.Sh SYNOPSIS
.Nm
+.Op Fl s Ar socket
.Ar command
.Op Ar argument ...
.Sh DESCRIPTION
@@ -36,6 +37,17 @@ Commands may be abbreviated to the minimum unambiguous prefix; for example,
for
.Cm show interfaces .
.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/eigrpd.sock
+to communicate with
+.Xr eigrpd 8 .
+.El
+.Pp
The following commands are available:
.Bl -tag -width Ds
.It Xo
diff --git a/usr.sbin/eigrpctl/eigrpctl.c b/usr.sbin/eigrpctl/eigrpctl.c
index c45ded6b5c8..c7c4baa039e 100644
--- a/usr.sbin/eigrpctl/eigrpctl.c
+++ b/usr.sbin/eigrpctl/eigrpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eigrpctl.c,v 1.8 2016/01/15 12:57:48 renato Exp $ */
+/* $OpenBSD: eigrpctl.c,v 1.9 2017/02/22 14:18:25 renato Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -68,7 +68,8 @@ usage(void)
{
extern char *__progname;
- fprintf(stderr, "usage: %s command [argument ...]\n", __progname);
+ fprintf(stderr, "usage: %s [-s socket] command [argument ...]\n",
+ __progname);
exit(1);
}
@@ -82,11 +83,27 @@ main(int argc, char *argv[])
int ctl_sock;
int done = 0;
int n, verbose = 0;
+ int ch;
+ char *sockname;
struct ctl_show_topology_req treq;
struct ctl_nbr nbr;
+ sockname = EIGRPD_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 eigrpd control socket */
@@ -95,9 +112,9 @@ main(int argc, char *argv[])
memset(&sun, 0, sizeof(sun));
sun.sun_family = AF_UNIX;
- strlcpy(sun.sun_path, EIGRPD_SOCKET, sizeof(sun.sun_path));
+ strlcpy(sun.sun_path, sockname, sizeof(sun.sun_path));
if (connect(ctl_sock, (struct sockaddr *)&sun, sizeof(sun)) == -1)
- err(1, "connect: %s", EIGRPD_SOCKET);
+ err(1, "connect: %s", sockname);
if (pledge("stdio", NULL) == -1)
err(1, "pledge");