summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2010-11-18 12:51:26 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2010-11-18 12:51:26 +0000
commit2a1d7c062bcf0f75e7b4afd53160e67c217616dd (patch)
treeabd82c71d2f4e6ba58457c9a2fdbcca8edea7b45
parent8f467793172de5ff019f0b29e5174970c7d3ccda (diff)
Log sent notification messages as well having them in the log may
help to figure out the cause of flapping session faster. OK henning@ sthen@
-rw-r--r--usr.sbin/bgpd/log.c21
-rw-r--r--usr.sbin/bgpd/session.c6
-rw-r--r--usr.sbin/bgpd/session.h4
3 files changed, 16 insertions, 15 deletions
diff --git a/usr.sbin/bgpd/log.c b/usr.sbin/bgpd/log.c
index 4bb061fadec..5c2d6909039 100644
--- a/usr.sbin/bgpd/log.c
+++ b/usr.sbin/bgpd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.53 2009/12/03 19:20:35 claudio Exp $ */
+/* $OpenBSD: log.c,v 1.54 2010/11/18 12:51:24 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -259,7 +259,7 @@ log_statechange(struct peer *peer, enum session_state nstate,
void
log_notification(const struct peer *peer, u_int8_t errcode, u_int8_t subcode,
- u_char *data, u_int16_t datalen)
+ u_char *data, u_int16_t datalen, const char *dir)
{
char *p;
const char *suberrname = NULL;
@@ -296,23 +296,22 @@ log_notification(const struct peer *peer, u_int8_t errcode, u_int8_t subcode,
uk = 1;
break;
default:
- logit(LOG_CRIT, "%s: received notification, unknown errcode "
- "%u, subcode %u", p, errcode, subcode);
+ logit(LOG_CRIT, "%s: %s notification, unknown errcode "
+ "%u, subcode %u", p, dir, errcode, subcode);
free(p);
return;
}
if (uk)
- logit(LOG_CRIT,
- "%s: received notification: %s, unknown subcode %u",
- p, errnames[errcode], subcode);
+ logit(LOG_CRIT, "%s: %s notification: %s, unknown subcode %u",
+ p, dir, errnames[errcode], subcode);
else {
if (suberrname == NULL)
- logit(LOG_CRIT, "%s: received notification: %s",
- p, errnames[errcode]);
+ logit(LOG_CRIT, "%s: %s notification: %s", p,
+ dir, errnames[errcode]);
else
- logit(LOG_CRIT, "%s: received notification: %s, %s",
- p, errnames[errcode], suberrname);
+ logit(LOG_CRIT, "%s: %s notification: %s, %s",
+ p, dir, errnames[errcode], suberrname);
}
free(p);
}
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index 122fde40c77..770296c5230 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.313 2010/11/10 15:14:36 claudio Exp $ */
+/* $OpenBSD: session.c,v 1.314 2010/11/18 12:51:24 claudio Exp $ */
/*
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
@@ -1458,6 +1458,8 @@ session_notification(struct peer *p, u_int8_t errcode, u_int8_t subcode,
if (p->stats.last_sent_errcode) /* some notification already sent */
return;
+ log_notification(p, errcode, subcode, data, datalen, "sending");
+
if ((buf = session_newmsg(NOTIFICATION,
MSGSIZE_NOTIFICATION_MIN + datalen)) == NULL) {
bgp_fsm(p, EVNT_CON_FATAL);
@@ -2057,7 +2059,7 @@ parse_notification(struct peer *peer)
p += sizeof(subcode);
datalen -= sizeof(subcode);
- log_notification(peer, errcode, subcode, p, datalen);
+ log_notification(peer, errcode, subcode, p, datalen, "received");
peer->errcnt++;
if (errcode == ERR_OPEN && subcode == ERR_OPEN_CAPA) {
diff --git a/usr.sbin/bgpd/session.h b/usr.sbin/bgpd/session.h
index 782e70789a7..7cc312bf851 100644
--- a/usr.sbin/bgpd/session.h
+++ b/usr.sbin/bgpd/session.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.h,v 1.109 2010/10/15 07:45:32 claudio Exp $ */
+/* $OpenBSD: session.h,v 1.110 2010/11/18 12:51:25 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -248,7 +248,7 @@ char *log_fmt_peer(const struct peer_config *);
void log_statechange(struct peer *, enum session_state,
enum session_events);
void log_notification(const struct peer *, u_int8_t, u_int8_t,
- u_char *, u_int16_t);
+ u_char *, u_int16_t, const char *);
void log_conn_attempt(const struct peer *, struct sockaddr *);
/* parse.y */