summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-11-02 20:38:46 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-11-02 20:38:46 +0000
commit4665d6e9f4a8b5f5b69e2062c0b42fda80c2a539 (patch)
tree12923dd7bd6c41e79105c8243072eb05e03453bd
parentd4634e25b09562de3e880667f1cb192c2b92df6d (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/bgpctl/bgpctl.88
-rw-r--r--usr.sbin/bgpctl/bgpctl.c15
-rw-r--r--usr.sbin/bgpctl/parser.c10
-rw-r--r--usr.sbin/bgpctl/parser.h4
4 files changed, 31 insertions, 6 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.8 b/usr.sbin/bgpctl/bgpctl.8
index 18c94fbbd6a..21e9da48299 100644
--- a/usr.sbin/bgpctl/bgpctl.8
+++ b/usr.sbin/bgpctl/bgpctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: bgpctl.8,v 1.50 2009/09/08 16:11:36 sthen Exp $
+.\" $OpenBSD: bgpctl.8,v 1.51 2009/11/02 20:38:45 claudio Exp $
.\"
.\" Copyright (c) 2003 Henning Brauer <henning@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: September 8 2009 $
+.Dd $Mdocdate: November 2 2009 $
.Dt BGPCTL 8
.Os
.Sh NAME
@@ -84,6 +84,10 @@ Fetch only IPv4 prefixes from the registry.
.It Fl 6
Fetch only IPv6 prefixes from the registry.
.El
+.It Cm log verbose
+Enable verbose debug logging.
+.It Cm log brief
+Disable verbose debug logging.
.It Cm neighbor Ar peer Cm up
Take the BGP session to the specified neighbor up.
.Ar peer
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c
index 65c92bde8fa..1b3af9d5de0 100644
--- a/usr.sbin/bgpctl/bgpctl.c
+++ b/usr.sbin/bgpctl/bgpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpctl.c,v 1.148 2009/10/23 16:00:28 claudio Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.149 2009/11/02 20:38:45 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -98,7 +98,7 @@ int
main(int argc, char *argv[])
{
struct sockaddr_un sun;
- int fd, n, done, ch, nodescr = 0;
+ int fd, n, done, ch, nodescr = 0, verbose = 0;
struct imsg imsg;
struct network_config net;
struct parse_result *res;
@@ -296,6 +296,15 @@ main(int argc, char *argv[])
&ribreq, sizeof(ribreq));
show_network_head();
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;
}
while (ibuf->w.queued)
@@ -373,6 +382,8 @@ main(int argc, char *argv[])
case NETWORK_REMOVE:
case NETWORK_FLUSH:
case IRRFILTER:
+ case LOG_VERBOSE:
+ case LOG_BRIEF:
break;
}
imsg_free(&imsg);
diff --git a/usr.sbin/bgpctl/parser.c b/usr.sbin/bgpctl/parser.c
index 423e997e7c4..10cf882eebc 100644
--- a/usr.sbin/bgpctl/parser.c
+++ b/usr.sbin/bgpctl/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.56 2009/09/08 16:11:36 sthen Exp $ */
+/* $OpenBSD: parser.c,v 1.57 2009/11/02 20:38:45 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -97,6 +97,7 @@ static const struct token t_prepself[];
static const struct token t_weight[];
static const struct token t_irrfilter[];
static const struct token t_irrfilter_opts[];
+static const struct token t_log[];
static const struct token t_main[] = {
{ KEYWORD, "reload", RELOAD, NULL},
@@ -105,6 +106,7 @@ static const struct token t_main[] = {
{ KEYWORD, "neighbor", NEIGHBOR, t_neighbor},
{ KEYWORD, "network", NONE, t_network},
{ KEYWORD, "irrfilter", IRRFILTER, t_irrfilter},
+ { KEYWORD, "log", NONE, t_log},
{ ENDTOKEN, "", NONE, NULL}
};
@@ -311,6 +313,12 @@ static const struct token t_irrfilter_opts[] = {
{ 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;
const struct token *match_token(int *argc, char **argv[],
diff --git a/usr.sbin/bgpctl/parser.h b/usr.sbin/bgpctl/parser.h
index 8adb5b5a9ce..6ce3943fa92 100644
--- a/usr.sbin/bgpctl/parser.h
+++ b/usr.sbin/bgpctl/parser.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.h,v 1.19 2009/06/06 06:05:41 claudio Exp $ */
+/* $OpenBSD: parser.h,v 1.20 2009/11/02 20:38:45 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -37,6 +37,8 @@ enum actions {
FIB,
FIB_COUPLE,
FIB_DECOUPLE,
+ LOG_VERBOSE,
+ LOG_BRIEF,
NEIGHBOR,
NEIGHBOR_UP,
NEIGHBOR_DOWN,