From 0991a9522eeb0c7735a7e45554c1698d9c79d89c Mon Sep 17 00:00:00 2001 From: Henning Brauer Date: Thu, 22 Jan 2004 21:09:01 +0000 Subject: 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. --- usr.sbin/bgpd/bgpd.h | 5 ++--- usr.sbin/bgpd/log.c | 14 +++++++++++++- usr.sbin/bgpd/parse.y | 3 ++- usr.sbin/bgpd/rde.c | 5 ++--- 4 files changed, 19 insertions(+), 8 deletions(-) (limited to 'usr.sbin/bgpd') 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 @@ -27,7 +27,6 @@ #include #include -#include #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 @@ -27,6 +27,7 @@ #include #include #include +#include #include #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) @@ -240,6 +242,16 @@ log_info(const char *emsg, ...) va_end(ap); } +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) { 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 @@ -31,6 +31,7 @@ #include #include #include +#include #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 @@ -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 : ""); -- cgit v1.2.3