summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ospfd/control.c
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2009-11-02 20:20:54 +0000
committerclaudio <claudio@openbsd.org>2009-11-02 20:20:54 +0000
commit636d06c3c3c72c74ae6d3c17bf98c92b0296f35c (patch)
tree49e1b858bb0816ec8003450707789c3d2c32f46c /usr.sbin/ospfd/control.c
parentDouble the escape timer (the time after a \033 is received before tmux gives up (diff)
downloadwireguard-openbsd-636d06c3c3c72c74ae6d3c17bf98c92b0296f35c.tar.xz
wireguard-openbsd-636d06c3c3c72c74ae6d3c17bf98c92b0296f35c.zip
Implement IMSG_CTL_LOG_VERBOSE to enable or disable debug logging on runtime.
It always annoyed me that in case of a problem I had to restart the ospf in forground debug mode and by doing so losing all routes at least twice. OK henning, sthen, michele
Diffstat (limited to 'usr.sbin/ospfd/control.c')
-rw-r--r--usr.sbin/ospfd/control.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/usr.sbin/ospfd/control.c b/usr.sbin/ospfd/control.c
index cc3a1c7c8fc..9f57bb03611 100644
--- a/usr.sbin/ospfd/control.c
+++ b/usr.sbin/ospfd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.27 2009/06/06 07:31:26 eric Exp $ */
+/* $OpenBSD: control.c,v 1.28 2009/11/02 20:20:54 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -193,6 +193,7 @@ control_dispatch_imsg(int fd, short event, void *bula)
struct imsg imsg;
ssize_t n;
unsigned int ifidx;
+ int verbose;
if ((c = control_connbyfd(fd)) == NULL) {
log_warn("control_dispatch_imsg: fd %d: not found", fd);
@@ -234,9 +235,8 @@ control_dispatch_imsg(int fd, short event, void *bula)
case IMSG_CTL_KROUTE_ADDR:
case IMSG_CTL_IFINFO:
c->iev.ibuf.pid = imsg.hdr.pid;
- ospfe_imsg_compose_parent(imsg.hdr.type,
- imsg.hdr.pid, imsg.data,
- imsg.hdr.len - IMSG_HEADER_SIZE);
+ ospfe_imsg_compose_parent(imsg.hdr.type, imsg.hdr.pid,
+ imsg.data, imsg.hdr.len - IMSG_HEADER_SIZE);
break;
case IMSG_CTL_SHOW_INTERFACE:
if (imsg.hdr.len == IMSG_HEADER_SIZE +
@@ -263,6 +263,20 @@ control_dispatch_imsg(int fd, short event, void *bula)
case IMSG_CTL_SHOW_NBR:
ospfe_nbr_ctl(c);
break;
+ case IMSG_CTL_LOG_VERBOSE:
+ if (imsg.hdr.len != IMSG_HEADER_SIZE +
+ sizeof(verbose))
+ break;
+
+ /* forward to other porcesses */
+ ospfe_imsg_compose_parent(imsg.hdr.type, imsg.hdr.pid,
+ imsg.data, imsg.hdr.len - IMSG_HEADER_SIZE);
+ ospfe_imsg_compose_rde(imsg.hdr.type, 0, imsg.hdr.pid,
+ imsg.data, imsg.hdr.len - IMSG_HEADER_SIZE);
+
+ memcpy(&verbose, imsg.data, sizeof(verbose));
+ log_verbose(verbose);
+ break;
default:
log_debug("control_dispatch_imsg: "
"error handling imsg %d", imsg.hdr.type);