diff options
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r-- | usr.sbin/bgpd/bgpd.c | 17 | ||||
-rw-r--r-- | usr.sbin/bgpd/bgpd.h | 22 | ||||
-rw-r--r-- | usr.sbin/bgpd/carp.c | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/config.c | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/control.c | 5 | ||||
-rw-r--r-- | usr.sbin/bgpd/kroute.c | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/log.c | 97 | ||||
-rw-r--r-- | usr.sbin/bgpd/log.h | 42 | ||||
-rw-r--r-- | usr.sbin/bgpd/logmsg.c | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/mrt.c | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/parse.y | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/pfkey.c | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/pftable.c | 4 | ||||
-rw-r--r-- | usr.sbin/bgpd/printconf.c | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde.c | 14 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde_attr.c | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde_decide.c | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde_filter.c | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde_prefix.c | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde_rib.c | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde_update.c | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/session.c | 12 | ||||
-rw-r--r-- | usr.sbin/bgpd/timer.c | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/util.c | 3 |
24 files changed, 149 insertions, 112 deletions
diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c index 74a5e11820c..ede5967246a 100644 --- a/usr.sbin/bgpd/bgpd.c +++ b/usr.sbin/bgpd/bgpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.c,v 1.187 2016/09/03 16:22:17 renato Exp $ */ +/* $OpenBSD: bgpd.c,v 1.188 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -30,11 +30,13 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <syslog.h> #include <unistd.h> #include "bgpd.h" #include "mrt.h" #include "session.h" +#include "log.h" void sighdlr(int); __dead void usage(void); @@ -112,10 +114,10 @@ main(int argc, char *argv[]) conffile = CONFFILE; bgpd_process = PROC_MAIN; - log_procname = log_procnames[bgpd_process]; - log_init(1); /* log to stderr until daemonized */ - log_verbose(1); + log_init(1, LOG_DAEMON); /* log to stderr until daemonized */ + log_procinit(log_procnames[bgpd_process]); + log_setverbose(1); saved_argv0 = argv[0]; if (saved_argv0 == NULL) @@ -147,7 +149,6 @@ main(int argc, char *argv[]) if (cmd_opts & BGPD_OPT_VERBOSE) cmd_opts |= BGPD_OPT_VERBOSE2; cmd_opts |= BGPD_OPT_VERBOSE; - log_verbose(1); break; case 'R': rflag = 1; @@ -189,8 +190,8 @@ main(int argc, char *argv[]) if (getpwnam(BGPD_USER) == NULL) errx(1, "unknown user %s", BGPD_USER); - log_init(debug); - log_verbose(cmd_opts & BGPD_OPT_VERBOSE); + log_init(debug, LOG_DAEMON); + log_setverbose(cmd_opts & BGPD_OPT_VERBOSE); if (!debug) daemon(1, 0); @@ -700,7 +701,7 @@ dispatch_imsg(struct imsgbuf *ibuf, int idx, struct bgpd_config *conf) case IMSG_CTL_LOG_VERBOSE: /* already checked by SE */ memcpy(&verbose, imsg.data, sizeof(verbose)); - log_verbose(verbose); + log_setverbose(verbose); break; case IMSG_RECONF_DONE: if (reconfpending == 0) diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index b105f3f48c9..4a2805a5e84 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.298 2017/01/13 18:59:12 phessler Exp $ */ +/* $OpenBSD: bgpd.h,v 1.299 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -33,8 +33,6 @@ #include <imsg.h> -#include "log.h" - #define BGP_VERSION 4 #define BGP_PORT 179 #define CONFFILE "/etc/bgpd.conf" @@ -1014,28 +1012,10 @@ int kr_reload(void); struct in6_addr *prefixlen2mask6(u_int8_t prefixlen); /* log.c */ -void log_init(int); -void log_verbose(int); -void logit(int, const char *, ...) - __attribute__((__format__ (printf, 2, 3))); -void vlog(int, const char *, va_list) - __attribute__((__format__ (printf, 2, 0))); void log_peer_warn(const struct peer_config *, const char *, ...) __attribute__((__format__ (printf, 2, 3))); void log_peer_warnx(const struct peer_config *, const char *, ...) __attribute__((__format__ (printf, 2, 3))); -void log_warn(const char *, ...) - __attribute__((__format__ (printf, 1, 2))); -void log_warnx(const char *, ...) - __attribute__((__format__ (printf, 1, 2))); -void log_info(const char *, ...) - __attribute__((__format__ (printf, 1, 2))); -void log_debug(const char *, ...) - __attribute__((__format__ (printf, 1, 2))); -void fatal(const char *, ...) __dead - __attribute__((__format__ (printf, 1, 2))); -void fatalx(const char *) __dead - __attribute__((__format__ (printf, 1, 0))); /* mrt.c */ void mrt_clear_seq(void); diff --git a/usr.sbin/bgpd/carp.c b/usr.sbin/bgpd/carp.c index 5ad40e3b1e1..71feb3dbc83 100644 --- a/usr.sbin/bgpd/carp.c +++ b/usr.sbin/bgpd/carp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: carp.c,v 1.8 2015/12/05 18:28:04 benno Exp $ */ +/* $OpenBSD: carp.c,v 1.9 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2006 Henning Brauer <henning@openbsd.org> @@ -28,6 +28,7 @@ #include "bgpd.h" #include "session.h" +#include "log.h" struct carpgroup { TAILQ_ENTRY(carpgroup) entry; diff --git a/usr.sbin/bgpd/config.c b/usr.sbin/bgpd/config.c index 0a1aa593eb9..adbfaf380ee 100644 --- a/usr.sbin/bgpd/config.c +++ b/usr.sbin/bgpd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.64 2017/01/17 22:10:55 krw Exp $ */ +/* $OpenBSD: config.c,v 1.65 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org> @@ -33,6 +33,7 @@ #include "bgpd.h" #include "session.h" +#include "log.h" u_int32_t get_bgpid(void); int host_v4(const char *, struct bgpd_addr *, u_int8_t *); diff --git a/usr.sbin/bgpd/control.c b/usr.sbin/bgpd/control.c index 63f41ae8072..dc4fd0db8ce 100644 --- a/usr.sbin/bgpd/control.c +++ b/usr.sbin/bgpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.85 2017/01/13 18:59:12 phessler Exp $ */ +/* $OpenBSD: control.c,v 1.86 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -27,6 +27,7 @@ #include "bgpd.h" #include "session.h" +#include "log.h" #define CONTROL_BACKLOG 5 @@ -499,7 +500,7 @@ control_dispatch_msg(struct pollfd *pfd, u_int *ctl_cnt) imsg.data, imsg.hdr.len - IMSG_HEADER_SIZE); memcpy(&verbose, imsg.data, sizeof(verbose)); - log_verbose(verbose); + log_setverbose(verbose); break; default: break; diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c index 90dbe6506df..b4edd7ffe24 100644 --- a/usr.sbin/bgpd/kroute.c +++ b/usr.sbin/bgpd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.210 2016/10/05 07:38:06 phessler Exp $ */ +/* $OpenBSD: kroute.c,v 1.211 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -36,6 +36,7 @@ #include <unistd.h> #include "bgpd.h" +#include "log.h" struct ktable **krt; u_int krt_size; diff --git a/usr.sbin/bgpd/log.c b/usr.sbin/bgpd/log.c index 9f9eac94ab8..1e22534f8c0 100644 --- a/usr.sbin/bgpd/log.c +++ b/usr.sbin/bgpd/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.62 2017/01/23 08:38:09 benno Exp $ */ +/* $OpenBSD: log.c,v 1.63 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -16,39 +16,54 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <errno.h> -#include <stdarg.h> #include <stdio.h> #include <stdlib.h> +#include <stdarg.h> #include <string.h> #include <syslog.h> +#include <errno.h> #include <time.h> #include "log.h" -int debug; -int verbose; -const char *log_procname; +static int debug; +static int verbose; +static const char *log_procname; void -log_init(int n_debug) +log_init(int n_debug, int facility) { extern char *__progname; debug = n_debug; + verbose = n_debug; + log_procinit(__progname); if (!debug) - openlog(__progname, LOG_PID | LOG_NDELAY, LOG_DAEMON); + openlog(__progname, LOG_PID | LOG_NDELAY, facility); tzset(); } void -log_verbose(int v) +log_procinit(const char *procname) +{ + if (procname != NULL) + log_procname = procname; +} + +void +log_setverbose(int v) { verbose = v; } +int +log_getverbose(void) +{ + return (verbose); +} + void logit(int pri, const char *fmt, ...) { @@ -63,6 +78,7 @@ void vlog(int pri, const char *fmt, va_list ap) { char *nfmt; + int saved_errno = errno; if (debug) { /* best effort in out of mem situations */ @@ -76,30 +92,36 @@ vlog(int pri, const char *fmt, va_list ap) fflush(stderr); } else vsyslog(pri, fmt, ap); + + errno = saved_errno; } void log_warn(const char *emsg, ...) { - char *nfmt; - va_list ap; + char *nfmt; + va_list ap; + int saved_errno = errno; /* best effort to even work in out of memory situations */ if (emsg == NULL) - logit(LOG_CRIT, "%s", strerror(errno)); + logit(LOG_CRIT, "%s", strerror(saved_errno)); else { va_start(ap, emsg); - if (asprintf(&nfmt, "%s: %s", emsg, strerror(errno)) == -1) { + if (asprintf(&nfmt, "%s: %s", emsg, + strerror(saved_errno)) == -1) { /* we tried it... */ vlog(LOG_CRIT, emsg, ap); - logit(LOG_CRIT, "%s", strerror(errno)); + logit(LOG_CRIT, "%s", strerror(saved_errno)); } else { vlog(LOG_CRIT, nfmt, ap); free(nfmt); } va_end(ap); } + + errno = saved_errno; } void @@ -134,33 +156,44 @@ log_debug(const char *emsg, ...) } } +static void +vfatalc(int code, const char *emsg, va_list ap) +{ + static char s[BUFSIZ]; + const char *sep; + + if (emsg != NULL) { + (void)vsnprintf(s, sizeof(s), emsg, ap); + sep = ": "; + } else { + s[0] = '\0'; + sep = ""; + } + if (code) + logit(LOG_CRIT, "fatal in %s: %s%s%s", + log_procname, s, sep, strerror(code)); + else + logit(LOG_CRIT, "fatal in %s%s%s", log_procname, sep, s); +} + void fatal(const char *emsg, ...) { - char s[1024]; - va_list ap; + va_list ap; va_start(ap, emsg); - vsnprintf(s, sizeof(s), emsg, ap); + vfatalc(errno, emsg, ap); va_end(ap); - - if (emsg == NULL) - logit(LOG_CRIT, "fatal in %s: %s", log_procname, - strerror(errno)); - else - if (errno) - logit(LOG_CRIT, "fatal in %s: %s: %s", - log_procname, s, strerror(errno)); - else - logit(LOG_CRIT, "fatal in %s: %s", - log_procname, s); - exit(1); } void -fatalx(const char *emsg) +fatalx(const char *emsg, ...) { - errno = 0; - fatal(emsg); + va_list ap; + + va_start(ap, emsg); + vfatalc(0, emsg, ap); + va_end(ap); + exit(1); } diff --git a/usr.sbin/bgpd/log.h b/usr.sbin/bgpd/log.h index d8a07707501..0b52f46b0eb 100644 --- a/usr.sbin/bgpd/log.h +++ b/usr.sbin/bgpd/log.h @@ -1,4 +1,4 @@ -/* $OpenBSD: log.h,v 1.18 2016/09/02 14:00:29 benno Exp $ */ +/* $OpenBSD: log.h,v 1.19 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -22,25 +22,25 @@ #include <stdarg.h> #include <sys/cdefs.h> -extern const char *log_procname; - -void log_init(int); -void log_verbose(int); -void logit(int, const char *, ...) - __attribute__((__format__ (printf, 2, 3))); -void vlog(int, const char *, va_list) - __attribute__((__format__ (printf, 2, 0))); -void log_warn(const char *, ...) - __attribute__((__format__ (printf, 1, 2))); -void log_warnx(const char *, ...) - __attribute__((__format__ (printf, 1, 2))); -void log_info(const char *, ...) - __attribute__((__format__ (printf, 1, 2))); -void log_debug(const char *, ...) - __attribute__((__format__ (printf, 1, 2))); -void fatal(const char *, ...) __dead - __attribute__((__format__ (printf, 1, 2))); -void fatalx(const char *) __dead - __attribute__((__format__ (printf, 1, 0))); +void log_init(int, int); +void log_procinit(const char *); +void log_setverbose(int); +int log_getverbose(void); +void log_warn(const char *, ...) + __attribute__((__format__ (printf, 1, 2))); +void log_warnx(const char *, ...) + __attribute__((__format__ (printf, 1, 2))); +void log_info(const char *, ...) + __attribute__((__format__ (printf, 1, 2))); +void log_debug(const char *, ...) + __attribute__((__format__ (printf, 1, 2))); +void logit(int, const char *, ...) + __attribute__((__format__ (printf, 2, 3))); +void vlog(int, const char *, va_list) + __attribute__((__format__ (printf, 2, 0))); +__dead void fatal(const char *, ...) + __attribute__((__format__ (printf, 1, 2))); +__dead void fatalx(const char *, ...) + __attribute__((__format__ (printf, 1, 2))); #endif /* LOG_H */ diff --git a/usr.sbin/bgpd/logmsg.c b/usr.sbin/bgpd/logmsg.c index 0061cbdec16..122d7025f36 100644 --- a/usr.sbin/bgpd/logmsg.c +++ b/usr.sbin/bgpd/logmsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: logmsg.c,v 1.1 2016/09/02 14:04:51 benno Exp $ */ +/* $OpenBSD: logmsg.c,v 1.2 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -26,6 +26,7 @@ #include "bgpd.h" #include "session.h" +#include "log.h" char * log_fmt_peer(const struct peer_config *peer) diff --git a/usr.sbin/bgpd/mrt.c b/usr.sbin/bgpd/mrt.c index 5021db09607..3448ac74005 100644 --- a/usr.sbin/bgpd/mrt.c +++ b/usr.sbin/bgpd/mrt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mrt.c,v 1.81 2015/12/30 12:06:56 benno Exp $ */ +/* $OpenBSD: mrt.c,v 1.82 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> @@ -32,6 +32,7 @@ #include "session.h" #include "mrt.h" +#include "log.h" int mrt_attr_dump(struct ibuf *, struct rde_aspath *, struct bgpd_addr *, int); int mrt_dump_entry_mp(struct mrt *, struct prefix *, u_int16_t, diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index efbc8d45f40..1d6a934587d 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.295 2017/01/18 04:28:45 phessler Exp $ */ +/* $OpenBSD: parse.y,v 1.296 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -44,6 +44,7 @@ #include "mrt.h" #include "session.h" #include "rde.h" +#include "log.h" TAILQ_HEAD(files, file) files = TAILQ_HEAD_INITIALIZER(files); static struct file { diff --git a/usr.sbin/bgpd/pfkey.c b/usr.sbin/bgpd/pfkey.c index 80ca9722ce5..5613b85df6e 100644 --- a/usr.sbin/bgpd/pfkey.c +++ b/usr.sbin/bgpd/pfkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkey.c,v 1.45 2015/09/13 10:22:16 florian Exp $ */ +/* $OpenBSD: pfkey.c,v 1.46 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -31,6 +31,7 @@ #include "bgpd.h" #include "session.h" +#include "log.h" #define PFKEY2_CHUNK sizeof(u_int64_t) #define ROUNDUP(x) (((x) + (PFKEY2_CHUNK - 1)) & ~(PFKEY2_CHUNK - 1)) diff --git a/usr.sbin/bgpd/pftable.c b/usr.sbin/bgpd/pftable.c index dbfa67517b5..a46dd5db688 100644 --- a/usr.sbin/bgpd/pftable.c +++ b/usr.sbin/bgpd/pftable.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pftable.c,v 1.9 2015/12/23 20:42:20 mmcc Exp $ */ +/* $OpenBSD: pftable.c,v 1.10 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2004 Damien Miller <djm@openbsd.org> @@ -29,6 +29,8 @@ #include <errno.h> #include <fcntl.h> +#include "log.h" + /* Namespace collision: these are defined in both bgpd.h and pfvar.h */ #undef v4 #undef v6 diff --git a/usr.sbin/bgpd/printconf.c b/usr.sbin/bgpd/printconf.c index 06a5e234d5e..78cae363096 100644 --- a/usr.sbin/bgpd/printconf.c +++ b/usr.sbin/bgpd/printconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: printconf.c,v 1.99 2016/10/14 16:05:36 phessler Exp $ */ +/* $OpenBSD: printconf.c,v 1.100 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -27,6 +27,7 @@ #include "mrt.h" #include "session.h" #include "rde.h" +#include "log.h" void print_op(enum comp_ops); void print_community(int, int); diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index c4c3ad31293..02762aa8b0c 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.357 2017/01/23 22:53:52 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.358 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -31,6 +31,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <syslog.h> #include <unistd.h> #include <err.h> @@ -38,6 +39,7 @@ #include "mrt.h" #include "rde.h" #include "session.h" +#include "log.h" #define PFD_PIPE_MAIN 0 #define PFD_PIPE_SESSION 1 @@ -170,11 +172,11 @@ rde_main(int debug, int verbose) int timeout; u_int8_t aid; - bgpd_process = PROC_RDE; - log_procname = log_procnames[bgpd_process]; + log_init(debug, LOG_DAEMON); + log_setverbose(verbose); - log_init(debug); - log_verbose(verbose); + bgpd_process = PROC_RDE; + log_procinit(log_procnames[bgpd_process]); if ((pw = getpwnam(BGPD_USER)) == NULL) fatal("getpwnam"); @@ -607,7 +609,7 @@ badnet: case IMSG_CTL_LOG_VERBOSE: /* already checked by SE */ memcpy(&verbose, imsg.data, sizeof(verbose)); - log_verbose(verbose); + log_setverbose(verbose); break; default: break; diff --git a/usr.sbin/bgpd/rde_attr.c b/usr.sbin/bgpd/rde_attr.c index c629f9d34df..e54227b93e1 100644 --- a/usr.sbin/bgpd/rde_attr.c +++ b/usr.sbin/bgpd/rde_attr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_attr.c,v 1.96 2016/10/14 16:05:36 phessler Exp $ */ +/* $OpenBSD: rde_attr.c,v 1.97 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org> @@ -31,6 +31,7 @@ #include "bgpd.h" #include "rde.h" +#include "log.h" int attr_write(void *p, u_int16_t p_len, u_int8_t flags, u_int8_t type, diff --git a/usr.sbin/bgpd/rde_decide.c b/usr.sbin/bgpd/rde_decide.c index 4127bc73a29..5e23b62a560 100644 --- a/usr.sbin/bgpd/rde_decide.c +++ b/usr.sbin/bgpd/rde_decide.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_decide.c,v 1.63 2017/01/23 22:47:59 claudio Exp $ */ +/* $OpenBSD: rde_decide.c,v 1.64 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> @@ -24,6 +24,7 @@ #include "bgpd.h" #include "rde.h" +#include "log.h" int prefix_cmp(struct prefix *, struct prefix *); /* diff --git a/usr.sbin/bgpd/rde_filter.c b/usr.sbin/bgpd/rde_filter.c index 31e92c0b632..229690b7802 100644 --- a/usr.sbin/bgpd/rde_filter.c +++ b/usr.sbin/bgpd/rde_filter.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_filter.c,v 1.79 2016/11/10 09:20:51 phessler Exp $ */ +/* $OpenBSD: rde_filter.c,v 1.80 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org> @@ -26,6 +26,7 @@ #include "bgpd.h" #include "rde.h" +#include "log.h" int rde_filter_match(struct filter_rule *, struct rde_aspath *, struct bgpd_addr *, u_int8_t, struct rde_peer *, struct rde_peer *); diff --git a/usr.sbin/bgpd/rde_prefix.c b/usr.sbin/bgpd/rde_prefix.c index f9a37f8e087..e1b64d96923 100644 --- a/usr.sbin/bgpd/rde_prefix.c +++ b/usr.sbin/bgpd/rde_prefix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_prefix.c,v 1.32 2010/03/26 15:41:04 claudio Exp $ */ +/* $OpenBSD: rde_prefix.c,v 1.33 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> @@ -25,6 +25,7 @@ #include "bgpd.h" #include "rde.h" +#include "log.h" /* * Prefix Table functions: diff --git a/usr.sbin/bgpd/rde_rib.c b/usr.sbin/bgpd/rde_rib.c index 907fd43f76c..7f716a1a2e4 100644 --- a/usr.sbin/bgpd/rde_rib.c +++ b/usr.sbin/bgpd/rde_rib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_rib.c,v 1.149 2017/01/23 22:53:52 claudio Exp $ */ +/* $OpenBSD: rde_rib.c,v 1.150 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> @@ -26,6 +26,7 @@ #include "bgpd.h" #include "rde.h" +#include "log.h" /* * BGP RIB -- Routing Information Base diff --git a/usr.sbin/bgpd/rde_update.c b/usr.sbin/bgpd/rde_update.c index 0d045550371..af01d7cf6b8 100644 --- a/usr.sbin/bgpd/rde_update.c +++ b/usr.sbin/bgpd/rde_update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_update.c,v 1.83 2017/01/23 11:33:41 claudio Exp $ */ +/* $OpenBSD: rde_update.c,v 1.84 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org> @@ -25,6 +25,7 @@ #include "bgpd.h" #include "rde.h" +#include "log.h" in_addr_t up_get_nexthop(struct rde_peer *, struct rde_aspath *); int up_generate_mp_reach(struct rde_peer *, struct update_attr *, diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index b710d27c135..aa88f165c3f 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.357 2017/01/13 18:59:12 phessler Exp $ */ +/* $OpenBSD: session.c,v 1.358 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org> @@ -40,11 +40,13 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <syslog.h> #include <unistd.h> #include "bgpd.h" #include "mrt.h" #include "session.h" +#include "log.h" #define PFD_PIPE_MAIN 0 #define PFD_PIPE_ROUTE 1 @@ -203,11 +205,11 @@ session_main(int debug, int verbose) void *newp; short events; - bgpd_process = PROC_SE; - log_procname = log_procnames[bgpd_process]; + log_init(debug, LOG_DAEMON); + log_setverbose(verbose); - log_init(debug); - log_verbose(verbose); + bgpd_process = PROC_SE; + log_procinit(log_procnames[bgpd_process]); if ((pw = getpwnam(BGPD_USER)) == NULL) fatal(NULL); diff --git a/usr.sbin/bgpd/timer.c b/usr.sbin/bgpd/timer.c index 65da0002955..b1bb5eec279 100644 --- a/usr.sbin/bgpd/timer.c +++ b/usr.sbin/bgpd/timer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: timer.c,v 1.16 2015/01/16 06:40:15 deraadt Exp $ */ +/* $OpenBSD: timer.c,v 1.17 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2003-2007 Henning Brauer <henning@openbsd.org> @@ -21,6 +21,7 @@ #include "bgpd.h" #include "session.h" +#include "log.h" #define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b)) diff --git a/usr.sbin/bgpd/util.c b/usr.sbin/bgpd/util.c index b6d908a1560..f6b264101fe 100644 --- a/usr.sbin/bgpd/util.c +++ b/usr.sbin/bgpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.23 2017/01/23 23:30:43 claudio Exp $ */ +/* $OpenBSD: util.c,v 1.24 2017/01/24 04:22:42 benno Exp $ */ /* * Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org> @@ -28,6 +28,7 @@ #include "bgpd.h" #include "rde.h" +#include "log.h" const char *aspath_delim(u_int8_t, int); |