summaryrefslogtreecommitdiffstats
path: root/usr.sbin/dvmrpctl
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2009-11-02 20:23:29 +0000
committerclaudio <claudio@openbsd.org>2009-11-02 20:23:29 +0000
commitc331907069073ad55c6b7ec9c91d7e1959a3bdf0 (patch)
tree854c941fe083675143827a05b9756c61482b0109 /usr.sbin/dvmrpctl
parentImplement IMSG_CTL_LOG_VERBOSE to enable or disable debug logging on runtime. (diff)
downloadwireguard-openbsd-c331907069073ad55c6b7ec9c91d7e1959a3bdf0.tar.xz
wireguard-openbsd-c331907069073ad55c6b7ec9c91d7e1959a3bdf0.zip
Implement "log verbose" and "log brief" to enable or disable verbose debug
logging. henning, sthen, michele like the idea
Diffstat (limited to 'usr.sbin/dvmrpctl')
-rw-r--r--usr.sbin/dvmrpctl/dvmrpctl.88
-rw-r--r--usr.sbin/dvmrpctl/dvmrpctl.c15
-rw-r--r--usr.sbin/dvmrpctl/parser.c11
-rw-r--r--usr.sbin/dvmrpctl/parser.h4
4 files changed, 32 insertions, 6 deletions
diff --git a/usr.sbin/dvmrpctl/dvmrpctl.8 b/usr.sbin/dvmrpctl/dvmrpctl.8
index f903319bd12..863addac4a0 100644
--- a/usr.sbin/dvmrpctl/dvmrpctl.8
+++ b/usr.sbin/dvmrpctl/dvmrpctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: dvmrpctl.8,v 1.6 2009/10/22 15:02:12 sobrado Exp $
+.\" $OpenBSD: dvmrpctl.8,v 1.7 2009/11/02 20:32:17 claudio Exp $
.\"
.\" Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org>
.\"
@@ -14,7 +14,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: October 22 2009 $
+.Dd $Mdocdate: November 2 2009 $
.Dt DVMRPCTL 8
.Os
.Sh NAME
@@ -33,6 +33,10 @@ daemon.
.Pp
The following commands are available:
.Bl -tag -width Ds
+.It Cm log verbose
+Enable verbose debug logging.
+.It Cm log brief
+Disable verbose debug logging.
.It Cm show igmp
Show IGMP status for all interfaces.
.It Cm show interfaces Op Ar interface
diff --git a/usr.sbin/dvmrpctl/dvmrpctl.c b/usr.sbin/dvmrpctl/dvmrpctl.c
index 5671258d51e..8cf8473afe9 100644
--- a/usr.sbin/dvmrpctl/dvmrpctl.c
+++ b/usr.sbin/dvmrpctl/dvmrpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dvmrpctl.c,v 1.8 2009/09/14 11:49:25 claudio Exp $ */
+/* $OpenBSD: dvmrpctl.c,v 1.9 2009/11/02 20:32:17 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -79,7 +79,7 @@ main(int argc, char *argv[])
struct imsg imsg;
unsigned int ifidx = 0;
int ctl_sock;
- int done = 0;
+ int done = 0, verbose = 0;
int n;
/* parse options */
@@ -155,6 +155,15 @@ main(int argc, char *argv[])
case SHOW_MFC_DTAIL:
imsg_compose(ibuf, IMSG_CTL_SHOW_MFC, 0, 0, -1, NULL, 0);
break;
+ case LOG_VERBOSE:
+ verbose = 1;
+ /* FALLTHROUGH */
+ case LOG_BRIEF:
+ imsg_compose(ibuf, IMSG_CTL_LOG_VERBOSE, 0, 0, -1,
+ &verbose, sizeof(verbose));
+ printf("logging request sent.\n");
+ done = 1;
+ break;
case RELOAD:
imsg_compose(ibuf, IMSG_CTL_RELOAD, 0, 0, -1, NULL, 0);
printf("reload request sent.\n");
@@ -210,6 +219,8 @@ main(int argc, char *argv[])
done = show_mfc_detail_msg(&imsg);
break;
case NONE:
+ case LOG_VERBOSE:
+ case LOG_BRIEF:
case RELOAD:
break;
}
diff --git a/usr.sbin/dvmrpctl/parser.c b/usr.sbin/dvmrpctl/parser.c
index c12f9364f0d..1dd0e447773 100644
--- a/usr.sbin/dvmrpctl/parser.c
+++ b/usr.sbin/dvmrpctl/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.2 2007/01/26 09:55:02 claudio Exp $ */
+/* $OpenBSD: parser.c,v 1.3 2009/11/02 20:32:17 claudio Exp $ */
/*
* Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org>
@@ -55,10 +55,12 @@ static const struct token t_show_nbr[];
static const struct token t_show_mfc[];
static const struct token t_show_rib[];
static const struct token t_show_fib[];
+static const struct token t_log[];
static const struct token t_main[] = {
/* {KEYWORD, "reload", RELOAD, NULL}, */
{KEYWORD, "show", SHOW, t_show},
+ {KEYWORD, "log", NONE, t_log},
{ENDTOKEN, "", NONE, NULL}
};
@@ -98,6 +100,13 @@ static const struct token t_show_rib[] = {
{ENDTOKEN, "", NONE, NULL}
};
+static const struct token t_log[] = {
+ {KEYWORD, "verbose", LOG_VERBOSE, NULL},
+ {KEYWORD, "brief", LOG_BRIEF, NULL},
+ {ENDTOKEN, "", NONE, NULL}
+};
+
+
static struct parse_result res;
struct parse_result *
diff --git a/usr.sbin/dvmrpctl/parser.h b/usr.sbin/dvmrpctl/parser.h
index 8bc19b7c7f9..56946315077 100644
--- a/usr.sbin/dvmrpctl/parser.h
+++ b/usr.sbin/dvmrpctl/parser.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.h,v 1.1 2006/06/01 14:21:28 norby Exp $ */
+/* $OpenBSD: parser.h,v 1.2 2009/11/02 20:32:17 claudio Exp $ */
/*
* Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org>
@@ -37,6 +37,8 @@ enum actions {
SHOW_RIB_DTAIL,
SHOW_MFC,
SHOW_MFC_DTAIL,
+ LOG_VERBOSE,
+ LOG_BRIEF,
RELOAD
};