summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2015-03-13 02:31:29 +0000
committerclaudio <claudio@openbsd.org>2015-03-13 02:31:29 +0000
commit9a2eee3533cad795e62fd0a3343438058f3ca69d (patch)
tree1054b5609fe7607ed7bd1ddeb71f99abfae1a5af
parentFix hardlink detection on platforms having padding in struct inodev, (diff)
downloadwireguard-openbsd-9a2eee3533cad795e62fd0a3343438058f3ca69d.tar.xz
wireguard-openbsd-9a2eee3533cad795e62fd0a3343438058f3ca69d.zip
Make sure that the debug messages include the neighbor ID so we hava a chance
to know which neighbor caused the problems. While there make sure that all messages log roughly in the same way.
-rw-r--r--usr.sbin/ospfd/database.c76
1 files changed, 42 insertions, 34 deletions
diff --git a/usr.sbin/ospfd/database.c b/usr.sbin/ospfd/database.c
index 569e6a4e2b3..59b79a0e692 100644
--- a/usr.sbin/ospfd/database.c
+++ b/usr.sbin/ospfd/database.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: database.c,v 1.31 2014/10/25 03:23:49 lteo Exp $ */
+/* $OpenBSD: database.c,v 1.32 2015/03/13 02:31:29 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -63,9 +63,9 @@ send_db_description(struct nbr *nbr)
case NBR_STA_INIT:
case NBR_STA_2_WAY:
case NBR_STA_SNAP:
- log_debug("send_db_description: cannot send packet in state %s,"
- " neighbor ID %s", nbr_state_name(nbr->state),
- inet_ntoa(nbr->id));
+ log_debug("send_db_description: neighbor ID %s: "
+ "cannot send packet in state %s", inet_ntoa(nbr->id),
+ nbr_state_name(nbr->state));
ret = -1;
goto done;
case NBR_STA_XSTRT:
@@ -167,8 +167,8 @@ recv_db_description(struct nbr *nbr, char *buf, u_int16_t len)
int dupe = 0;
if (len < sizeof(dd_hdr)) {
- log_warnx("recv_db_description: "
- "bad packet size, neighbor ID %s", inet_ntoa(nbr->id));
+ log_warnx("recv_db_description: neighbor ID %s: ",
+ "bad packet size", inet_ntoa(nbr->id));
return;
}
memcpy(&dd_hdr, buf, sizeof(dd_hdr));
@@ -177,9 +177,9 @@ recv_db_description(struct nbr *nbr, char *buf, u_int16_t len)
/* db description packet sanity checks */
if (ntohs(dd_hdr.iface_mtu) > nbr->iface->mtu) {
- log_warnx("recv_db_description: invalid MTU %d sent by "
- "neighbor ID %s, expected %d", ntohs(dd_hdr.iface_mtu),
- inet_ntoa(nbr->id), nbr->iface->mtu);
+ log_warnx("recv_db_description: neighbor ID %s: "
+ "invalid MTU %d expected %d", inet_ntoa(nbr->id),
+ ntohs(dd_hdr.iface_mtu), nbr->iface->mtu);
return;
}
@@ -187,7 +187,7 @@ recv_db_description(struct nbr *nbr, char *buf, u_int16_t len)
nbr->last_rx_bits == dd_hdr.bits &&
ntohl(dd_hdr.dd_seq_num) == nbr->dd_seq_num - nbr->dd_master ?
1 : 0) {
- log_debug("recv_db_description: dupe from ID %s",
+ log_debug("recv_db_description: dupe from neighbor ID %s",
inet_ntoa(nbr->id));
dupe = 1;
}
@@ -197,9 +197,9 @@ recv_db_description(struct nbr *nbr, char *buf, u_int16_t len)
case NBR_STA_ATTEMPT:
case NBR_STA_2_WAY:
case NBR_STA_SNAP:
- log_debug("recv_db_description: packet ignored in state %s, "
- "neighbor ID %s", nbr_state_name(nbr->state),
- inet_ntoa(nbr->id));
+ log_debug("recv_db_description: neighbor ID %s: "
+ "packet ignored in state %s", inet_ntoa(nbr->id),
+ nbr_state_name(nbr->state));
return;
case NBR_STA_INIT:
/* evaluate dr and bdr after issuing a 2-Way event */
@@ -235,9 +235,11 @@ recv_db_description(struct nbr *nbr, char *buf, u_int16_t len)
} else if (!(dd_hdr.bits & (OSPF_DBD_I | OSPF_DBD_MS))) {
/* M only case: we are master */
if (ntohl(dd_hdr.dd_seq_num) != nbr->dd_seq_num) {
- log_warnx("recv_db_description: invalid "
- "seq num, mine %x his %x",
- nbr->dd_seq_num, ntohl(dd_hdr.dd_seq_num));
+ log_warnx("recv_db_description: "
+ "neighbor ID %s: "
+ "invalid seq num, mine %x his %x",
+ inet_ntoa(nbr->id), nbr->dd_seq_num,
+ ntohl(dd_hdr.dd_seq_num));
return;
}
nbr->dd_seq_num++;
@@ -253,9 +255,9 @@ recv_db_description(struct nbr *nbr, char *buf, u_int16_t len)
}
} else {
/* ignore packet */
- log_debug("recv_db_description: packet ignored in "
- "state %s (bad flags), neighbor ID %s",
- nbr_state_name(nbr->state), inet_ntoa(nbr->id));
+ log_debug("recv_db_description: neighbor ID %s: "
+ "packet ignored in state %s (bad flags)",
+ inet_ntoa(nbr->id), nbr_state_name(nbr->state));
}
break;
case NBR_STA_XCHNG:
@@ -263,15 +265,16 @@ recv_db_description(struct nbr *nbr, char *buf, u_int16_t len)
case NBR_STA_FULL:
if (dd_hdr.bits & OSPF_DBD_I ||
!(dd_hdr.bits & OSPF_DBD_MS) == !nbr->dd_master) {
- log_warnx("recv_db_description: seq num mismatch, "
- "bad flags");
+ log_warnx("recv_db_description: neighbor ID %s: "
+ "seq num mismatch, bad flags", inet_ntoa(nbr->id));
nbr_fsm(nbr, NBR_EVT_SEQ_NUM_MIS);
return;
}
if (nbr->last_rx_options != dd_hdr.opts) {
- log_warnx("recv_db_description: seq num mismatch, "
- "bad options");
+ log_warnx("recv_db_description: neighbor ID %s: "
+ "seq num mismatch, bad options",
+ inet_ntoa(nbr->id));
nbr_fsm(nbr, NBR_EVT_SEQ_NUM_MIS);
return;
}
@@ -284,9 +287,10 @@ recv_db_description(struct nbr *nbr, char *buf, u_int16_t len)
}
if (nbr->state != NBR_STA_XCHNG) {
- log_warnx("recv_db_description: invalid "
- "seq num, mine %x his %x",
- nbr->dd_seq_num, ntohl(dd_hdr.dd_seq_num));
+ log_warnx("recv_db_description: neighbor ID %s: "
+ "invalid seq num, mine %x his %x",
+ inet_ntoa(nbr->id), nbr->dd_seq_num,
+ ntohl(dd_hdr.dd_seq_num));
nbr_fsm(nbr, NBR_EVT_SEQ_NUM_MIS);
return;
}
@@ -295,9 +299,11 @@ recv_db_description(struct nbr *nbr, char *buf, u_int16_t len)
if (nbr->dd_master) {
/* master */
if (ntohl(dd_hdr.dd_seq_num) != nbr->dd_seq_num) {
- log_warnx("recv_db_description: invalid "
- "seq num, mine %x his %x",
- nbr->dd_seq_num, ntohl(dd_hdr.dd_seq_num));
+ log_warnx("recv_db_description: "
+ "neighbor ID %s: "
+ "invalid seq num, mine %x his %x, master",
+ inet_ntoa(nbr->id), nbr->dd_seq_num,
+ ntohl(dd_hdr.dd_seq_num));
nbr_fsm(nbr, NBR_EVT_SEQ_NUM_MIS);
return;
}
@@ -305,9 +311,11 @@ recv_db_description(struct nbr *nbr, char *buf, u_int16_t len)
} else {
/* slave */
if (ntohl(dd_hdr.dd_seq_num) != nbr->dd_seq_num + 1) {
- log_warnx("recv_db_description: invalid "
- "seq num, mine %x his %x",
- nbr->dd_seq_num, ntohl(dd_hdr.dd_seq_num));
+ log_warnx("recv_db_description: "
+ "neighbor ID %s: "
+ "invalid seq num, mine %x his %x, slave",
+ inet_ntoa(nbr->id), nbr->dd_seq_num,
+ ntohl(dd_hdr.dd_seq_num));
nbr_fsm(nbr, NBR_EVT_SEQ_NUM_MIS);
return;
}
@@ -391,8 +399,8 @@ db_tx_timer(int fd, short event, void *arg)
send_db_description(nbr);
break;
default:
- log_debug("db_tx_timer: unknown neighbor state, "
- "neighbor ID %s", inet_ntoa(nbr->id));
+ log_debug("db_tx_timer: neighbor ID %s: unknown neighbor state",
+ inet_ntoa(nbr->id));
break;
}