diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-11-02 20:29:18 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-11-02 20:29:18 +0000 |
commit | 0b0b1baf26e53c033ac0be651cf6100e3ed7b97a (patch) | |
tree | e0df7c5eb11b76b1f151643fc9a509192db19d09 | |
parent | 73e30d30e9303ec154a841cb0fc722fe96b77344 (diff) |
Implement "log verbose" and "log brief" to enable or disable verbose debug
logging. henning, sthen, michele like the idea
-rw-r--r-- | usr.sbin/ripctl/parser.c | 10 | ||||
-rw-r--r-- | usr.sbin/ripctl/parser.h | 4 | ||||
-rw-r--r-- | usr.sbin/ripctl/ripctl.8 | 8 | ||||
-rw-r--r-- | usr.sbin/ripctl/ripctl.c | 15 |
4 files changed, 31 insertions, 6 deletions
diff --git a/usr.sbin/ripctl/parser.c b/usr.sbin/ripctl/parser.c index da8d5e433d0..6d6fa52f536 100644 --- a/usr.sbin/ripctl/parser.c +++ b/usr.sbin/ripctl/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.2 2007/01/26 10:04:56 claudio Exp $ */ +/* $OpenBSD: parser.c,v 1.3 2009/11/02 20:29:17 claudio Exp $ */ /* * Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it> @@ -59,11 +59,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} }; @@ -107,6 +109,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/ripctl/parser.h b/usr.sbin/ripctl/parser.h index 7ab1bba7979..fa471da57a6 100644 --- a/usr.sbin/ripctl/parser.h +++ b/usr.sbin/ripctl/parser.h @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.h,v 1.1 2006/10/18 16:15:25 norby Exp $ */ +/* $OpenBSD: parser.h,v 1.2 2009/11/02 20:29:17 claudio Exp $ */ /* * Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it> @@ -30,6 +30,8 @@ enum actions { FIB, FIB_COUPLE, FIB_DECOUPLE, + LOG_VERBOSE, + LOG_BRIEF, SHOW, SHOW_IFACE, SHOW_NBR, diff --git a/usr.sbin/ripctl/ripctl.8 b/usr.sbin/ripctl/ripctl.8 index 5b60ef1a8a4..8c05d6535eb 100644 --- a/usr.sbin/ripctl/ripctl.8 +++ b/usr.sbin/ripctl/ripctl.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ripctl.8,v 1.7 2009/10/22 15:02:12 sobrado Exp $ +.\" $OpenBSD: ripctl.8,v 1.8 2009/11/02 20:29:17 claudio Exp $ .\" .\" Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it> .\" 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: October 22 2009 $ +.Dd $Mdocdate: November 2 2009 $ .Dt RIPCTL 8 .Os .Sh NAME @@ -42,6 +42,10 @@ Remove the learned routes from the Forward Information Base a.k.a. the kernel routing table. Decoupling the FIB from an RIP router may create routing loops and could cause major routing issues. +.It Cm log verbose +Enable verbose debug logging. +.It Cm log brief +Disable verbose debug logging. .It Cm show fib Op Ar destination | filter Show the Forwarding Information Base. .Ar destination diff --git a/usr.sbin/ripctl/ripctl.c b/usr.sbin/ripctl/ripctl.c index dc463d2b602..939af71b3d6 100644 --- a/usr.sbin/ripctl/ripctl.c +++ b/usr.sbin/ripctl/ripctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ripctl.c,v 1.9 2009/09/14 11:49:25 claudio Exp $ +/* $OpenBSD: ripctl.c,v 1.10 2009/11/02 20:29:17 claudio Exp $ * * Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it> * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -70,7 +70,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 */ @@ -150,6 +150,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"); @@ -193,6 +202,8 @@ main(int argc, char *argv[]) case FIB: case FIB_COUPLE: case FIB_DECOUPLE: + case LOG_VERBOSE: + case LOG_BRIEF: case RELOAD: break; } |