summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2010-01-11 06:40:15 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2010-01-11 06:40:15 +0000
commitef71cd3fc87017bde947092f6497a6bed6c41732 (patch)
treea6e9c52da3ff2d91df0a87f766a66e5fe7f6a267 /usr.sbin/relayd
parenta47132c529785bf8305ce4c99000eebf7ecf2209 (diff)
add "log brief" and "log verbose" to change logging verbosity
like several other things in the tree. ok reyk@ looks fine claudio@
Diffstat (limited to 'usr.sbin/relayd')
-rw-r--r--usr.sbin/relayd/control.c19
-rw-r--r--usr.sbin/relayd/hce.c7
-rw-r--r--usr.sbin/relayd/log.c12
-rw-r--r--usr.sbin/relayd/relay.c7
-rw-r--r--usr.sbin/relayd/relayd.c7
-rw-r--r--usr.sbin/relayd/relayd.h4
6 files changed, 49 insertions, 7 deletions
diff --git a/usr.sbin/relayd/control.c b/usr.sbin/relayd/control.c
index 66ee4bfc5ce..b205b93d3b0 100644
--- a/usr.sbin/relayd/control.c
+++ b/usr.sbin/relayd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.33 2009/12/02 19:10:02 mk Exp $ */
+/* $OpenBSD: control.c,v 1.34 2010/01/11 06:40:14 jsg Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -196,6 +196,7 @@ control_dispatch_imsg(int fd, short event, void *arg)
struct imsg imsg;
struct ctl_id id;
int n;
+ int verbose;
struct relayd *env = arg;
if ((c = control_connbyfd(fd)) == NULL) {
@@ -356,6 +357,22 @@ control_dispatch_imsg(int fd, short event, void *arg)
}
c->flags |= CTL_CONN_NOTIFY;
break;
+ case IMSG_CTL_LOG_VERBOSE:
+ if (imsg.hdr.len != IMSG_HEADER_SIZE +
+ sizeof(verbose))
+ break;
+
+ memcpy(&verbose, imsg.data, sizeof(verbose));
+
+ imsg_compose_event(iev_hce, IMSG_CTL_LOG_VERBOSE,
+ 0, 0, -1, &verbose, sizeof(verbose));
+ imsg_compose_event(iev_main, IMSG_CTL_LOG_VERBOSE,
+ 0, 0, -1, &verbose, sizeof(verbose));
+ memcpy(imsg.data, &verbose, sizeof(verbose));
+ control_imsg_forward(&imsg);
+
+ log_verbose(verbose);
+ break;
default:
log_debug("control_dispatch_imsg: "
"error handling imsg %d", imsg.hdr.type);
diff --git a/usr.sbin/relayd/hce.c b/usr.sbin/relayd/hce.c
index f33417f44b1..96a8aac9141 100644
--- a/usr.sbin/relayd/hce.c
+++ b/usr.sbin/relayd/hce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hce.c,v 1.53 2009/06/05 23:39:51 pyr Exp $ */
+/* $OpenBSD: hce.c,v 1.54 2010/01/11 06:40:14 jsg Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -368,6 +368,7 @@ hce_dispatch_imsg(int fd, short event, void *ptr)
objid_t id;
struct host *host;
struct table *table;
+ int verbose;
iev = ptr;
ibuf = &iev->ibuf;
@@ -435,6 +436,10 @@ hce_dispatch_imsg(int fd, short event, void *ptr)
table->skipped = 0;
hce_launch_checks(-1, EV_TIMEOUT, env);
break;
+ case IMSG_CTL_LOG_VERBOSE:
+ memcpy(&verbose, imsg.data, sizeof(verbose));
+ log_verbose(verbose);
+ break;
default:
log_debug("hce_dispatch_msg: unexpected imsg %d",
imsg.hdr.type);
diff --git a/usr.sbin/relayd/log.c b/usr.sbin/relayd/log.c
index 411d08c442d..d19895a113a 100644
--- a/usr.sbin/relayd/log.c
+++ b/usr.sbin/relayd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.14 2008/12/05 16:37:55 reyk Exp $ */
+/* $OpenBSD: log.c,v 1.15 2010/01/11 06:40:14 jsg Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -41,6 +41,7 @@
#include "relayd.h"
int debug;
+int verbose;
void vlog(int, const char *, va_list);
void logit(int, const char *, ...);
@@ -51,6 +52,7 @@ log_init(int n_debug)
extern char *__progname;
debug = n_debug;
+ verbose = n_debug;
if (!debug)
openlog(__progname, LOG_PID | LOG_NDELAY, LOG_DAEMON);
@@ -59,6 +61,12 @@ log_init(int n_debug)
}
void
+log_verbose(int v)
+{
+ verbose = v;
+}
+
+void
logit(int pri, const char *fmt, ...)
{
va_list ap;
@@ -137,7 +145,7 @@ log_debug(const char *emsg, ...)
{
va_list ap;
- if (debug > 1) {
+ if (verbose > 1) {
va_start(ap, emsg);
vlog(LOG_DEBUG, emsg, ap);
va_end(ap);
diff --git a/usr.sbin/relayd/relay.c b/usr.sbin/relayd/relay.c
index 6f66788b441..0aa6d2c158a 100644
--- a/usr.sbin/relayd/relay.c
+++ b/usr.sbin/relayd/relay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay.c,v 1.117 2009/08/07 11:21:53 reyk Exp $ */
+/* $OpenBSD: relay.c,v 1.118 2010/01/11 06:40:14 jsg Exp $ */
/*
* Copyright (c) 2006, 2007, 2008 Reyk Floeter <reyk@openbsd.org>
@@ -2405,6 +2405,7 @@ relay_dispatch_pfe(int fd, short event, void *ptr)
struct table *table;
struct ctl_status st;
objid_t id;
+ int verbose;
iev = ptr;
ibuf = &iev->ibuf;
@@ -2508,6 +2509,10 @@ relay_dispatch_pfe(int fd, short event, void *ptr)
imsg_compose_event(iev, IMSG_CTL_END,
0, 0, -1, NULL, 0);
break;
+ case IMSG_CTL_LOG_VERBOSE:
+ memcpy(&verbose, imsg.data, sizeof(verbose));
+ log_verbose(verbose);
+ break;
default:
log_debug("relay_dispatch_msg: unexpected imsg %d",
imsg.hdr.type);
diff --git a/usr.sbin/relayd/relayd.c b/usr.sbin/relayd/relayd.c
index 7c6f9f3b84b..b0e89f61460 100644
--- a/usr.sbin/relayd/relayd.c
+++ b/usr.sbin/relayd/relayd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayd.c,v 1.93 2009/11/11 13:09:39 jsg Exp $ */
+/* $OpenBSD: relayd.c,v 1.94 2010/01/11 06:40:14 jsg Exp $ */
/*
* Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org>
@@ -617,6 +617,7 @@ main_dispatch_pfe(int fd, short event, void *ptr)
struct ctl_demote demote;
struct ctl_netroute crt;
struct relayd *env;
+ int verbose;
iev = ptr;
ibuf = &iev->ibuf;
@@ -667,6 +668,10 @@ main_dispatch_pfe(int fd, short event, void *ptr)
*/
reconfigure();
break;
+ case IMSG_CTL_LOG_VERBOSE:
+ memcpy(&verbose, imsg.data, sizeof(verbose));
+ log_verbose(verbose);
+ break;
default:
log_debug("main_dispatch_pfe: unexpected imsg %d",
imsg.hdr.type);
diff --git a/usr.sbin/relayd/relayd.h b/usr.sbin/relayd/relayd.h
index 15ce555866b..878ed1e62d8 100644
--- a/usr.sbin/relayd/relayd.h
+++ b/usr.sbin/relayd/relayd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayd.h,v 1.132 2009/11/03 21:33:22 reyk Exp $ */
+/* $OpenBSD: relayd.h,v 1.133 2010/01/11 06:40:14 jsg Exp $ */
/*
* Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -735,6 +735,7 @@ enum imsg_type {
IMSG_CTL_NOTIFY,
IMSG_CTL_RDR_STATS,
IMSG_CTL_RELAY_STATS,
+ IMSG_CTL_LOG_VERBOSE,
IMSG_RDR_ENABLE, /* notifies from pfe to hce */
IMSG_RDR_DISABLE,
IMSG_TABLE_ENABLE,
@@ -931,6 +932,7 @@ u_int16_t shuffle_generate16(struct shuffle *);
/* log.c */
void log_init(int);
+void log_verbose(int);
void log_warn(const char *, ...);
void log_warnx(const char *, ...);
void log_info(const char *, ...);