diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-22 21:09:01 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-22 21:09:01 +0000 |
commit | 0991a9522eeb0c7735a7e45554c1698d9c79d89c (patch) | |
tree | 404b84817386c20df27dc236877d50b6c4f13c91 /usr.sbin/bgpd | |
parent | ab5125e110d669f4ecd17be205d2235ecdaa8466 (diff) |
provide a log_debug and use it in rde.c.
with this, logit() can be a private function.
we don't need to include syslog.h in bgpd.h any more; log.c and parse.y
who need it include it directly now.
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r-- | usr.sbin/bgpd/bgpd.h | 5 | ||||
-rw-r--r-- | usr.sbin/bgpd/log.c | 14 | ||||
-rw-r--r-- | usr.sbin/bgpd/parse.y | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde.c | 5 |
4 files changed, 19 insertions, 8 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index 8009478c036..9cf7b38fa94 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.77 2004/01/22 20:59:16 henning Exp $ */ +/* $OpenBSD: bgpd.h,v 1.78 2004/01/22 21:08:59 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -27,7 +27,6 @@ #include <poll.h> #include <stdarg.h> -#include <syslog.h> #define BGP_VERSION 4 #define BGP_PORT 179 @@ -282,13 +281,13 @@ int msgbuf_unbounded(struct msgbuf *msgbuf); /* log.c */ void log_init(int); -void logit(int, const char *, ...); void vlog(int, const char *, va_list); void log_peer_warn(const struct peer_config *, const char *, ...); void log_peer_warnx(const struct peer_config *, const char *, ...); void log_warn(const char *, ...); void log_warnx(const char *, ...); void log_info(const char *, ...); +void log_debug(const char *, ...); void fatal(const char *); void fatalx(const char *); void fatal_ensure(const char *, int, const char *); diff --git a/usr.sbin/bgpd/log.c b/usr.sbin/bgpd/log.c index e3db40b6ff7..40669a22521 100644 --- a/usr.sbin/bgpd/log.c +++ b/usr.sbin/bgpd/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.20 2004/01/22 20:59:17 henning Exp $ */ +/* $OpenBSD: log.c,v 1.21 2004/01/22 21:09:00 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -27,6 +27,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <syslog.h> #include <unistd.h> #include "bgpd.h" @@ -101,6 +102,7 @@ static const char *procnames[] = { }; char *log_fmt_peer(const struct peer_config *); +void logit(int, const char *, ...); char * log_fmt_peer(const struct peer_config *peer) @@ -241,6 +243,16 @@ log_info(const char *emsg, ...) } void +log_debug(const char *emsg, ...) +{ + va_list ap; + + va_start(ap, emsg); + vlog(LOG_DEBUG, emsg, ap); + va_end(ap); +} + +void fatal(const char *emsg) { if (emsg == NULL) diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index 16a797bb886..6167efd8ede 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.36 2004/01/17 19:35:36 claudio Exp $ */ +/* $OpenBSD: parse.y,v 1.37 2004/01/22 21:09:00 henning Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -31,6 +31,7 @@ #include <stdarg.h> #include <stdio.h> #include <string.h> +#include <syslog.h> #include "bgpd.h" #include "mrt.h" diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index 5898cb8795b..eb5a1a127c2 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.66 2004/01/22 21:01:26 henning Exp $ */ +/* $OpenBSD: rde.c,v 1.67 2004/01/22 21:09:00 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -578,8 +578,7 @@ rde_update_log(const char *message, asprintf(&nexthop, " via %s", inet_ntoa(nh)); } - logit(LOG_DEBUG, "neighbor %s (AS%u) %s %s/%u" - "%s", + log_debug("neighbor %s (AS%u) %s %s/%u %s", neighbor, peer->conf.remote_as, message, inet_ntoa(prefix->v4), prefixlen, nexthop ? nexthop : ""); |