-/* $OpenBSD: bgpd.h,v 1.306 2017/05/28 15:16:33 henning Exp $ */
+/* $OpenBSD: bgpd.h,v 1.307 2017/05/28 20:14:15 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
struct in6_addr *prefixlen2mask6(u_int8_t prefixlen);
/* log.c */
+void log_peer_info(const struct peer_config *, const char *, ...)
+ __attribute__((__format__ (printf, 2, 3)));
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 *, ...)
-/* $OpenBSD: logmsg.c,v 1.2 2017/01/24 04:22:42 benno Exp $ */
+/* $OpenBSD: logmsg.c,v 1.3 2017/05/28 20:14:15 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
return (pfmt);
}
+void
+log_peer_info(const struct peer_config *peer, const char *emsg, ...)
+{
+ char *p, *nfmt;
+ va_list ap;
+
+ p = log_fmt_peer(peer);
+ if (asprintf(&nfmt, "%s: %s", p, emsg) == -1)
+ fatal(NULL);
+ va_start(ap, emsg);
+ vlog(LOG_INFO, nfmt, ap);
+ va_end(ap);
+ free(p);
+ free(nfmt);
+}
+
void
log_peer_warn(const struct peer_config *peer, const char *emsg, ...)
{
fatal(NULL);
}
va_start(ap, emsg);
- vlog(LOG_CRIT, nfmt, ap);
+ vlog(LOG_ERR, nfmt, ap);
va_end(ap);
free(p);
free(nfmt);
if (asprintf(&nfmt, "%s: %s", p, emsg) == -1)
fatal(NULL);
va_start(ap, emsg);
- vlog(LOG_CRIT, nfmt, ap);
+ vlog(LOG_ERR, nfmt, ap);
va_end(ap);
free(p);
free(nfmt);
suberrname = suberr_fsm_names[subcode];
break;
default:
- logit(LOG_CRIT, "%s: %s notification, unknown errcode "
+ logit(LOG_ERR, "%s: %s notification, unknown errcode "
"%u, subcode %u", p, dir, errcode, subcode);
free(p);
return;
}
if (uk)
- logit(LOG_CRIT, "%s: %s notification: %s, unknown subcode %u",
+ logit(LOG_ERR, "%s: %s notification: %s, unknown subcode %u",
p, dir, errnames[errcode], subcode);
else {
if (suberrname == NULL)
- logit(LOG_CRIT, "%s: %s notification: %s", p,
+ logit(LOG_ERR, "%s: %s notification: %s", p,
dir, errnames[errcode]);
else
- logit(LOG_CRIT, "%s: %s notification: %s, %s",
+ logit(LOG_ERR, "%s: %s notification: %s, %s",
p, dir, errnames[errcode], suberrname);
}
free(p);