summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfctl
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-11-02 20:23:30 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-11-02 20:23:30 +0000
commit5dfb6db929c9e9f9ca4cb190f229e5748e0c0d74 (patch)
treef3792c3c6e5d5c654f5838e5aec17559552269d5 /usr.sbin/ospfctl
parentaa53dd77fecb39b8af5c2ae7d479db56e491f531 (diff)
Implement "log verbose" and "log brief" to enable or disable verbose debug
logging. henning, sthen, michele like the idea
Diffstat (limited to 'usr.sbin/ospfctl')
-rw-r--r--usr.sbin/ospfctl/ospfctl.88
-rw-r--r--usr.sbin/ospfctl/ospfctl.c15
-rw-r--r--usr.sbin/ospfctl/parser.c10
-rw-r--r--usr.sbin/ospfctl/parser.h4
4 files changed, 31 insertions, 6 deletions
diff --git a/usr.sbin/ospfctl/ospfctl.8 b/usr.sbin/ospfctl/ospfctl.8
index 13641715ce0..637288f9d20 100644
--- a/usr.sbin/ospfctl/ospfctl.8
+++ b/usr.sbin/ospfctl/ospfctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ospfctl.8,v 1.22 2009/10/22 15:02:12 sobrado Exp $
+.\" $OpenBSD: ospfctl.8,v 1.23 2009/11/02 20:23:29 claudio Exp $
.\"
.\" Copyright (c) 2004, 2005 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 OSPFCTL 8
.Os
.Sh NAME
@@ -54,6 +54,10 @@ a.k.a. the kernel routing table.
Decoupling the FIB from an OSPF router may create routing loops and could cause
major routing issues in the complete OSPF cloud.
Only routers with just one link to the OSPF cloud can safely decouple the FIB.
+.It Cm log verbose
+Enable verbose debug logging.
+.It Cm log brief
+Disable verbose debug logging.
.It Cm reload
Reload the configuration file.
.It Cm show database Op Ar filter
diff --git a/usr.sbin/ospfctl/ospfctl.c b/usr.sbin/ospfctl/ospfctl.c
index d770e5dbd92..af601c9fe21 100644
--- a/usr.sbin/ospfctl/ospfctl.c
+++ b/usr.sbin/ospfctl/ospfctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfctl.c,v 1.49 2009/09/14 11:49:25 claudio Exp $ */
+/* $OpenBSD: ospfctl.c,v 1.50 2009/11/02 20:23:29 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -90,7 +90,7 @@ main(int argc, char *argv[])
unsigned int ifidx = 0;
int ctl_sock;
int done = 0;
- int n;
+ int n, verbose = 0;
int ch;
char *sockname;
@@ -220,6 +220,15 @@ main(int argc, char *argv[])
printf("decouple request sent.\n");
done = 1;
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");
@@ -287,6 +296,8 @@ main(int argc, char *argv[])
case FIB:
case FIB_COUPLE:
case FIB_DECOUPLE:
+ case LOG_VERBOSE:
+ case LOG_BRIEF:
case RELOAD:
break;
}
diff --git a/usr.sbin/ospfctl/parser.c b/usr.sbin/ospfctl/parser.c
index 3ca83589c15..8cfacec25eb 100644
--- a/usr.sbin/ospfctl/parser.c
+++ b/usr.sbin/ospfctl/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.15 2007/10/14 01:28:08 deraadt Exp $ */
+/* $OpenBSD: parser.c,v 1.16 2009/11/02 20:23:29 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -58,11 +58,13 @@ static const struct token t_show_area[];
static const struct token t_show_nbr[];
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, "fib", FIB, t_fib},
{KEYWORD, "show", SHOW, t_show},
+ {KEYWORD, "log", NONE, t_log},
{ENDTOKEN, "", NONE, NULL}
};
@@ -129,6 +131,12 @@ static const struct token t_show_fib[] = {
{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/ospfctl/parser.h b/usr.sbin/ospfctl/parser.h
index 3386d9883eb..2815000c26c 100644
--- a/usr.sbin/ospfctl/parser.h
+++ b/usr.sbin/ospfctl/parser.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.h,v 1.8 2006/03/23 18:37:34 norby Exp $ */
+/* $OpenBSD: parser.h,v 1.9 2009/11/02 20:23:29 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -29,6 +29,8 @@ enum actions {
FIB,
FIB_COUPLE,
FIB_DECOUPLE,
+ LOG_VERBOSE,
+ LOG_BRIEF,
SHOW,
SHOW_SUM,
SHOW_IFACE,