diff options
-rw-r--r-- | usr.sbin/ldpctl/ldpctl.8 | 8 | ||||
-rw-r--r-- | usr.sbin/ldpctl/ldpctl.c | 15 | ||||
-rw-r--r-- | usr.sbin/ldpctl/parser.c | 10 | ||||
-rw-r--r-- | usr.sbin/ldpctl/parser.h | 4 |
4 files changed, 31 insertions, 6 deletions
diff --git a/usr.sbin/ldpctl/ldpctl.8 b/usr.sbin/ldpctl/ldpctl.8 index 8be245cf672..2ee3db89bcd 100644 --- a/usr.sbin/ldpctl/ldpctl.8 +++ b/usr.sbin/ldpctl/ldpctl.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ldpctl.8,v 1.2 2009/10/27 16:22:15 sobrado Exp $ +.\" $OpenBSD: ldpctl.8,v 1.3 2009/11/02 20:35:20 claudio Exp $ .\" .\" Copyright (c) 2009 Michele Marchetto <michele@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: October 27 2009 $ +.Dd $Mdocdate: November 2 2009 $ .Dt LDPCTL 8 .Os .Sh NAME @@ -40,6 +40,10 @@ the kernel routing table. .It Cm lfib decouple Remove the learned routes from the Label Forwarding Information Base a.k.a. the kernel routing table. +.It Cm log verbose +Enable verbose debug logging. +.It Cm log brief +Disable verbose debug logging. .It Cm show lfib Op Ar destination | filter Show the Label Forwarding Information Base. .Ar destination diff --git a/usr.sbin/ldpctl/ldpctl.c b/usr.sbin/ldpctl/ldpctl.c index 05a0e6e91af..5369d86b928 100644 --- a/usr.sbin/ldpctl/ldpctl.c +++ b/usr.sbin/ldpctl/ldpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldpctl.c,v 1.5 2009/09/14 11:49:25 claudio Exp $ +/* $OpenBSD: ldpctl.c,v 1.6 2009/11/02 20:35:20 claudio Exp $ * * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -71,7 +71,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 */ @@ -151,6 +151,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"); @@ -194,6 +203,8 @@ main(int argc, char *argv[]) case LFIB: case LFIB_COUPLE: case LFIB_DECOUPLE: + case LOG_VERBOSE: + case LOG_BRIEF: case RELOAD: break; } diff --git a/usr.sbin/ldpctl/parser.c b/usr.sbin/ldpctl/parser.c index 6285a3c4945..f3652d2a105 100644 --- a/usr.sbin/ldpctl/parser.c +++ b/usr.sbin/ldpctl/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.1 2009/06/01 20:59:45 michele Exp $ */ +/* $OpenBSD: parser.c,v 1.2 2009/11/02 20:35:20 claudio Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -59,11 +59,13 @@ static const struct token t_show_area[]; static const struct token t_show_nbr[]; static const struct token t_show_lib[]; static const struct token t_show_lfib[]; +static const struct token t_log[]; static const struct token t_main[] = { /* {KEYWORD, "reload", RELOAD, NULL}, */ {KEYWORD, "lfib", LFIB, t_lfib}, {KEYWORD, "show", SHOW, t_show}, + {KEYWORD, "log", NONE, t_log}, {ENDTOKEN, "", NONE, NULL} }; @@ -97,6 +99,12 @@ static const struct token t_show_lib[] = { {ENDTOKEN, "", NONE, NULL} }; +static const struct token t_log[] = { + {KEYWORD, "verbose", LOG_VERBOSE, NULL}, + {KEYWORD, "brief", LOG_BRIEF, NULL}, + {ENDTOKEN, "", NONE, NULL} +}; + static const struct token t_show_lfib[] = { {NOTOKEN, "", NONE, NULL}, {KEYWORD, "interface", SHOW_LFIB_IFACE, t_show_iface}, diff --git a/usr.sbin/ldpctl/parser.h b/usr.sbin/ldpctl/parser.h index b05a9a7af23..78a72bb7d4f 100644 --- a/usr.sbin/ldpctl/parser.h +++ b/usr.sbin/ldpctl/parser.h @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.h,v 1.1 2009/06/01 20:59:45 michele Exp $ */ +/* $OpenBSD: parser.h,v 1.2 2009/11/02 20:35:20 claudio Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -30,6 +30,8 @@ enum actions { LFIB, LFIB_COUPLE, LFIB_DECOUPLE, + LOG_VERBOSE, + LOG_BRIEF, SHOW, SHOW_IFACE, SHOW_NBR, |