From 73e30d30e9303ec154a841cb0fc722fe96b77344 Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Mon, 2 Nov 2009 20:28:50 +0000 Subject: Another routing daemon that gets IMSG_CTL_LOG_VERBOSE to allow toggeling of log_debug(). ok michele, henning, sthen --- usr.sbin/ripd/control.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'usr.sbin/ripd/control.c') diff --git a/usr.sbin/ripd/control.c b/usr.sbin/ripd/control.c index 917ecb5dfaf..27751ace744 100644 --- a/usr.sbin/ripd/control.c +++ b/usr.sbin/ripd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.10 2009/06/06 08:20:55 eric Exp $ */ +/* $OpenBSD: control.c,v 1.11 2009/11/02 20:28:48 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -192,6 +192,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); @@ -254,6 +255,20 @@ control_dispatch_imsg(int fd, short event, void *bula) c->iev.ibuf.pid = imsg.hdr.pid; ripe_imsg_compose_parent(imsg.hdr.type, 0, NULL, 0); break; + case IMSG_CTL_LOG_VERBOSE: + if (imsg.hdr.len != IMSG_HEADER_SIZE + + sizeof(verbose)) + break; + + /* forward to other porcesses */ + ripe_imsg_compose_parent(imsg.hdr.type, imsg.hdr.pid, + imsg.data, imsg.hdr.len - IMSG_HEADER_SIZE); + ripe_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); -- cgit v1.2.3