summaryrefslogtreecommitdiff
path: root/usr.sbin/ospf6d
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2021-11-03 21:40:04 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2021-11-03 21:40:04 +0000
commit90ca5606a6e7ea8372d8b4a71fd7699b35a4cfd7 (patch)
tree96ea0ac652f8e01ec4a39724f985da08d4ead6d5 /usr.sbin/ospf6d
parent7e05ab86fba7ef778775f9716b36ea8a37a24115 (diff)
log the interface along with the neighbour ID in various ospfd/ospf6d
messages. ok remi@ benno@ if a neighbour is reachable over multiple network links, some problems may be related to the link itself rather than the neighbour, so knowing the interface can be important when trying to locate the source of a problem.
Diffstat (limited to 'usr.sbin/ospf6d')
-rw-r--r--usr.sbin/ospf6d/database.c67
-rw-r--r--usr.sbin/ospf6d/kroute.c4
-rw-r--r--usr.sbin/ospf6d/lsack.c23
-rw-r--r--usr.sbin/ospf6d/lsreq.c9
-rw-r--r--usr.sbin/ospf6d/lsupdate.c24
-rw-r--r--usr.sbin/ospf6d/neighbor.c33
6 files changed, 90 insertions, 70 deletions
diff --git a/usr.sbin/ospf6d/database.c b/usr.sbin/ospf6d/database.c
index 1b1b831c943..febe11934ea 100644
--- a/usr.sbin/ospf6d/database.c
+++ b/usr.sbin/ospf6d/database.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: database.c,v 1.20 2020/07/15 14:47:41 denis Exp $ */
+/* $OpenBSD: database.c,v 1.21 2021/11/03 21:40:03 sthen Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -60,9 +60,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: neighbor ID %s: "
+ log_debug("send_db_description: neighbor ID %s (%s): "
"cannot send packet in state %s", inet_ntoa(nbr->id),
- nbr_state_name(nbr->state));
+ nbr->iface->name, nbr_state_name(nbr->state));
goto fail;
case NBR_STA_XSTRT:
bits |= OSPF_DBD_MS | OSPF_DBD_M | OSPF_DBD_I;
@@ -160,8 +160,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: neighbor ID %s: "
- "bad packet size", inet_ntoa(nbr->id));
+ log_warnx("recv_db_description: neighbor ID %s (%s): "
+ "bad packet size", inet_ntoa(nbr->id), nbr->iface->name);
return;
}
memcpy(&dd_hdr, buf, sizeof(dd_hdr));
@@ -170,9 +170,10 @@ 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: neighbor ID %s: "
+ log_warnx("recv_db_description: neighbor ID %s (%s): "
"invalid MTU %d expected %d", inet_ntoa(nbr->id),
- ntohs(dd_hdr.iface_mtu), nbr->iface->mtu);
+ nbr->iface->name, ntohs(dd_hdr.iface_mtu),
+ nbr->iface->mtu);
return;
}
@@ -180,8 +181,9 @@ 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 neighbor ID %s",
- inet_ntoa(nbr->id));
+ log_debug("recv_db_description: dupe from "
+ "neighbor ID %s (%s)", inet_ntoa(nbr->id),
+ nbr->iface->name);
dupe = 1;
}
@@ -190,9 +192,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: neighbor ID %s: "
+ log_debug("recv_db_description: neighbor ID %s (%s): "
"packet ignored in state %s", inet_ntoa(nbr->id),
- nbr_state_name(nbr->state));
+ nbr->iface->name, nbr_state_name(nbr->state));
return;
case NBR_STA_INIT:
/* evaluate dr and bdr after issuing a 2-Way event */
@@ -222,10 +224,10 @@ recv_db_description(struct nbr *nbr, char *buf, u_int16_t len)
/* M only case: we are master */
if (ntohl(dd_hdr.dd_seq_num) != nbr->dd_seq_num) {
log_warnx("recv_db_description: "
- "neighbor ID %s: "
+ "neighbor ID %s (%s): "
"invalid seq num, mine %x his %x",
- inet_ntoa(nbr->id), nbr->dd_seq_num,
- ntohl(dd_hdr.dd_seq_num));
+ inet_ntoa(nbr->id), nbr->iface->name,
+ nbr->dd_seq_num, ntohl(dd_hdr.dd_seq_num));
return;
}
nbr->dd_seq_num++;
@@ -241,9 +243,10 @@ recv_db_description(struct nbr *nbr, char *buf, u_int16_t len)
}
} else {
/* ignore packet */
- log_debug("recv_db_description: neighbor ID %s: "
+ log_debug("recv_db_description: neighbor ID %s (%s): "
"packet ignored in state %s (bad flags)",
- inet_ntoa(nbr->id), nbr_state_name(nbr->state));
+ inet_ntoa(nbr->id), nbr->iface->name,
+ nbr_state_name(nbr->state));
}
break;
case NBR_STA_XCHNG:
@@ -251,16 +254,17 @@ 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: neighbor ID %s: "
- "seq num mismatch, bad flags", inet_ntoa(nbr->id));
+ log_warnx("recv_db_description: neighbor ID %s (%s): "
+ "seq num mismatch, bad flags", inet_ntoa(nbr->id),
+ nbr->iface->name);
nbr_fsm(nbr, NBR_EVT_SEQ_NUM_MIS);
return;
}
if (nbr->last_rx_options != dd_hdr.opts) {
- log_warnx("recv_db_description: neighbor ID %s: "
+ log_warnx("recv_db_description: neighbor ID %s (%s): "
"seq num mismatch, bad options",
- inet_ntoa(nbr->id));
+ inet_ntoa(nbr->id), nbr->iface->name);
nbr_fsm(nbr, NBR_EVT_SEQ_NUM_MIS);
return;
}
@@ -273,10 +277,10 @@ recv_db_description(struct nbr *nbr, char *buf, u_int16_t len)
}
if (nbr->state != NBR_STA_XCHNG) {
- log_warnx("recv_db_description: neighbor ID %s: "
+ log_warnx("recv_db_description: neighbor ID %s (%s): "
"invalid seq num, mine %x his %x",
- inet_ntoa(nbr->id), nbr->dd_seq_num,
- ntohl(dd_hdr.dd_seq_num));
+ inet_ntoa(nbr->id), nbr->iface->name,
+ nbr->dd_seq_num, ntohl(dd_hdr.dd_seq_num));
nbr_fsm(nbr, NBR_EVT_SEQ_NUM_MIS);
return;
}
@@ -286,10 +290,10 @@ recv_db_description(struct nbr *nbr, char *buf, u_int16_t len)
/* master */
if (ntohl(dd_hdr.dd_seq_num) != nbr->dd_seq_num) {
log_warnx("recv_db_description: "
- "neighbor ID %s: "
+ "neighbor ID %s (%s): "
"invalid seq num, mine %x his %x, master",
- inet_ntoa(nbr->id), nbr->dd_seq_num,
- ntohl(dd_hdr.dd_seq_num));
+ inet_ntoa(nbr->id), nbr->iface->name,
+ nbr->dd_seq_num, ntohl(dd_hdr.dd_seq_num));
nbr_fsm(nbr, NBR_EVT_SEQ_NUM_MIS);
return;
}
@@ -298,10 +302,10 @@ recv_db_description(struct nbr *nbr, char *buf, u_int16_t len)
/* slave */
if (ntohl(dd_hdr.dd_seq_num) != nbr->dd_seq_num + 1) {
log_warnx("recv_db_description: "
- "neighbor ID %s: "
+ "neighbor ID %s (%s): "
"invalid seq num, mine %x his %x, slave",
- inet_ntoa(nbr->id), nbr->dd_seq_num,
- ntohl(dd_hdr.dd_seq_num));
+ inet_ntoa(nbr->id), nbr->iface->name,
+ nbr->dd_seq_num, ntohl(dd_hdr.dd_seq_num));
nbr_fsm(nbr, NBR_EVT_SEQ_NUM_MIS);
return;
}
@@ -385,8 +389,9 @@ db_tx_timer(int fd, short event, void *arg)
send_db_description(nbr);
break;
default:
- log_debug("db_tx_timer: neighbor ID %s: unknown neighbor state",
- inet_ntoa(nbr->id));
+ log_debug("db_tx_timer: neighbor ID %s (%s): "
+ "unknown neighbor state",
+ inet_ntoa(nbr->id), nbr->iface->name);
break;
}
diff --git a/usr.sbin/ospf6d/kroute.c b/usr.sbin/ospf6d/kroute.c
index e805b1ab6bb..0edf4b99d33 100644
--- a/usr.sbin/ospf6d/kroute.c
+++ b/usr.sbin/ospf6d/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.65 2020/09/10 05:18:16 jmatthew Exp $ */
+/* $OpenBSD: kroute.c,v 1.66 2021/11/03 21:40:03 sthen Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -1107,7 +1107,7 @@ send_rtmsg(int fd, int action, struct kroute *kroute)
/*
* We don't have an interface address in that network,
* so we install a cloning route. The kernel will then
- * do neigbor discovery.
+ * do neighbor discovery.
*/
bzero(&ifp, sizeof(ifp));
ifp.addr.sdl_len = sizeof(struct sockaddr_dl);
diff --git a/usr.sbin/ospf6d/lsack.c b/usr.sbin/ospf6d/lsack.c
index abacf022241..d3c2d65a15b 100644
--- a/usr.sbin/ospf6d/lsack.c
+++ b/usr.sbin/ospf6d/lsack.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lsack.c,v 1.8 2019/12/28 09:25:24 denis Exp $ */
+/* $OpenBSD: lsack.c,v 1.9 2021/11/03 21:40:03 sthen Exp $ */
/*
* Copyright (c) 2004, 2005, 2007 Esben Norby <norby@openbsd.org>
@@ -105,8 +105,8 @@ recv_ls_ack(struct nbr *nbr, char *buf, u_int16_t len)
case NBR_STA_XSTRT:
case NBR_STA_SNAP:
log_debug("recv_ls_ack: packet ignored in state %s, "
- "neighbor ID %s", nbr_state_name(nbr->state),
- inet_ntoa(nbr->id));
+ "neighbor ID %s (%s)", nbr_state_name(nbr->state),
+ inet_ntoa(nbr->id), nbr->iface->name);
break;
case NBR_STA_XCHNG:
case NBR_STA_LOAD:
@@ -127,7 +127,8 @@ recv_ls_ack(struct nbr *nbr, char *buf, u_int16_t len)
}
if (len > 0) {
log_warnx("recv_ls_ack: bad packet size, "
- "neighbor ID %s", inet_ntoa(nbr->id));
+ "neighbor ID %s (%s)", inet_ntoa(nbr->id),
+ nbr->iface->name);
return;
}
break;
@@ -141,8 +142,8 @@ lsa_hdr_check(struct nbr *nbr, struct lsa_hdr *lsa_hdr)
{
/* invalid age */
if ((ntohs(lsa_hdr->age) < 1) || (ntohs(lsa_hdr->age) > MAX_AGE)) {
- log_debug("lsa_hdr_check: invalid age, neighbor ID %s",
- inet_ntoa(nbr->id));
+ log_debug("lsa_hdr_check: invalid age, neighbor ID %s (%s)",
+ inet_ntoa(nbr->id), nbr->iface->name);
return (0);
}
@@ -157,15 +158,17 @@ lsa_hdr_check(struct nbr *nbr, struct lsa_hdr *lsa_hdr)
case LSA_TYPE_EXTERNAL:
break;
default:
- log_debug("lsa_hdr_check: invalid LSA type %d, neighbor ID %s",
- lsa_hdr->type, inet_ntoa(nbr->id));
+ log_debug("lsa_hdr_check: invalid LSA type %d, "
+ "neighbor ID %s (%s)",
+ lsa_hdr->type, inet_ntoa(nbr->id), nbr->iface->name);
return (0);
}
/* invalid sequence number */
if (ntohl(lsa_hdr->seq_num) == RESV_SEQ_NUM) {
- log_debug("ls_hdr_check: invalid seq num, neighbor ID %s",
- inet_ntoa(nbr->id));
+ log_debug("ls_hdr_check: invalid seq num, "
+ "neighbor ID %s (%s)", inet_ntoa(nbr->id),
+ nbr->iface->name);
return (0);
}
diff --git a/usr.sbin/ospf6d/lsreq.c b/usr.sbin/ospf6d/lsreq.c
index 65966197ba8..13de5057ef5 100644
--- a/usr.sbin/ospf6d/lsreq.c
+++ b/usr.sbin/ospf6d/lsreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lsreq.c,v 1.12 2021/01/19 09:53:11 claudio Exp $ */
+/* $OpenBSD: lsreq.c,v 1.13 2021/11/03 21:40:03 sthen Exp $ */
/*
* Copyright (c) 2004, 2005, 2007 Esben Norby <norby@openbsd.org>
@@ -96,8 +96,8 @@ recv_ls_req(struct nbr *nbr, char *buf, u_int16_t len)
case NBR_STA_XSTRT:
case NBR_STA_SNAP:
log_debug("recv_ls_req: packet ignored in state %s, "
- "neighbor ID %s", nbr_state_name(nbr->state),
- inet_ntoa(nbr->id));
+ "neighbor ID %s (%s)", nbr_state_name(nbr->state),
+ inet_ntoa(nbr->id), nbr->iface->name);
break;
case NBR_STA_XCHNG:
case NBR_STA_LOAD:
@@ -209,7 +209,8 @@ ls_req_tx_timer(int fd, short event, void *arg)
return;
default:
log_debug("ls_req_tx_timer: unknown neighbor state, "
- "neighbor ID %s", inet_ntoa(nbr->id));
+ "neighbor ID %s (%s)", inet_ntoa(nbr->id),
+ nbr->iface->name);
break;
}
diff --git a/usr.sbin/ospf6d/lsupdate.c b/usr.sbin/ospf6d/lsupdate.c
index a7df58d28a1..9305139ad31 100644
--- a/usr.sbin/ospf6d/lsupdate.c
+++ b/usr.sbin/ospf6d/lsupdate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lsupdate.c,v 1.20 2021/01/19 09:53:11 claudio Exp $ */
+/* $OpenBSD: lsupdate.c,v 1.21 2021/11/03 21:40:03 sthen Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -243,8 +243,9 @@ recv_ls_update(struct nbr *nbr, char *buf, u_int16_t len)
u_int32_t nlsa;
if (len < sizeof(nlsa)) {
- log_warnx("recv_ls_update: bad packet size, neighbor ID %s",
- inet_ntoa(nbr->id));
+ log_warnx("recv_ls_update: bad packet size, "
+ "neighbor ID %s (%s)", inet_ntoa(nbr->id),
+ nbr->iface->name);
return;
}
memcpy(&nlsa, buf, sizeof(nlsa));
@@ -260,8 +261,8 @@ recv_ls_update(struct nbr *nbr, char *buf, u_int16_t len)
case NBR_STA_XSTRT:
case NBR_STA_SNAP:
log_debug("recv_ls_update: packet ignored in state %s, "
- "neighbor ID %s", nbr_state_name(nbr->state),
- inet_ntoa(nbr->id));
+ "neighbor ID %s (%s)", nbr_state_name(nbr->state),
+ inet_ntoa(nbr->id), nbr->iface->name);
break;
case NBR_STA_XCHNG:
case NBR_STA_LOAD:
@@ -269,13 +270,15 @@ recv_ls_update(struct nbr *nbr, char *buf, u_int16_t len)
for (; nlsa > 0 && len > 0; nlsa--) {
if (len < sizeof(lsa)) {
log_warnx("recv_ls_update: bad packet size, "
- "neighbor ID %s", inet_ntoa(nbr->id));
+ "neighbor ID %s (%s)", inet_ntoa(nbr->id),
+ nbr->iface->name);
return;
}
memcpy(&lsa, buf, sizeof(lsa));
if (len < ntohs(lsa.len)) {
log_warnx("recv_ls_update: bad packet size, "
- "neighbor ID %s", inet_ntoa(nbr->id));
+ "neighbor ID %s (%s)", inet_ntoa(nbr->id),
+ nbr->iface->name);
return;
}
ospfe_imsg_compose_rde(IMSG_LS_UPD, nbr->peerid, 0,
@@ -285,7 +288,8 @@ recv_ls_update(struct nbr *nbr, char *buf, u_int16_t len)
}
if (nlsa > 0 || len > 0) {
log_warnx("recv_ls_update: bad packet size, "
- "neighbor ID %s", inet_ntoa(nbr->id));
+ "neighbor ID %s (%s)", inet_ntoa(nbr->id),
+ nbr->iface->name);
return;
}
break;
@@ -497,8 +501,8 @@ ls_retrans_timer(int fd, short event, void *bula)
if (nlsa == 0) {
/* something bad happened retry later */
log_warnx("ls_retrans_timer: sending LS update "
- "to neighbor ID %s failed",
- inet_ntoa(nbr->id));
+ "to neighbor ID %s (%s) failed",
+ inet_ntoa(nbr->id), nbr->iface->name);
log_debug("ls_retrans_timer: type: %04x len: %u",
ntohs(le->le_ref->hdr.type),
le->le_ref->len);
diff --git a/usr.sbin/ospf6d/neighbor.c b/usr.sbin/ospf6d/neighbor.c
index 6a655ceb1df..8834ef917ea 100644
--- a/usr.sbin/ospf6d/neighbor.c
+++ b/usr.sbin/ospf6d/neighbor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: neighbor.c,v 1.17 2020/06/22 18:18:20 denis Exp $ */
+/* $OpenBSD: neighbor.c,v 1.18 2021/11/03 21:40:03 sthen Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -136,9 +136,10 @@ nbr_fsm(struct nbr *nbr, enum nbr_event event)
if (nbr_fsm_tbl[i].state == -1) {
/* event outside of the defined fsm, ignore it. */
- log_warnx("nbr_fsm: neighbor ID %s, "
+ log_warnx("nbr_fsm: neighbor ID %s (%s), "
"event %s not expected in state %s",
- inet_ntoa(nbr->id), nbr_event_names[event],
+ inet_ntoa(nbr->id), nbr->iface->name,
+ nbr_event_names[event],
nbr_state_name(old_state));
return (0);
}
@@ -184,8 +185,9 @@ nbr_fsm(struct nbr *nbr, enum nbr_event event)
}
if (ret) {
- log_warnx("nbr_fsm: error changing state for neighbor ID %s, "
- "event %s, state %s", inet_ntoa(nbr->id),
+ log_warnx("nbr_fsm: error changing state for neighbor "
+ "ID %s (%s), event %s, state %s",
+ inet_ntoa(nbr->id), nbr->iface->name,
nbr_event_names[event], nbr_state_name(old_state));
return (-1);
}
@@ -218,10 +220,11 @@ nbr_fsm(struct nbr *nbr, enum nbr_event event)
if_fsm(nbr->iface, IF_EVT_NBR_CHNG);
log_debug("nbr_fsm: event %s resulted in action %s and "
- "changing state for neighbor ID %s from %s to %s",
+ "changing state for neighbor ID %s (%s) from %s to %s",
nbr_event_names[event],
nbr_action_names[nbr_fsm_tbl[i].action],
- inet_ntoa(nbr->id), nbr_state_name(old_state),
+ inet_ntoa(nbr->id), nbr->iface->name,
+ nbr_state_name(old_state),
nbr_state_name(nbr->state));
if (nbr->iface->type == IF_TYPE_VIRTUALLINK) {
@@ -437,8 +440,9 @@ nbr_adj_timer(int fd, short event, void *arg)
return;
if (nbr->state & NBR_STA_ACTIVE && nbr->state != NBR_STA_FULL) {
- log_warnx("nbr_adj_timer: failed to form adjacency with %s",
- inet_ntoa(nbr->id));
+ log_warnx("nbr_adj_timer: failed to form adjacency with "
+ "neighbor ID %s on interface %s",
+ inet_ntoa(nbr->id), nbr->iface->name);
nbr_fsm(nbr, NBR_EVT_ADJTMOUT);
}
}
@@ -527,7 +531,8 @@ nbr_act_snapshot(struct nbr *nbr)
/* we need to wait for the old snapshot to finish */
if (nbr->dd_snapshot) {
log_debug("nbr_act_snapshot: giving up, old snapshot running "
- "for neigbor ID %s", inet_ntoa(nbr->id));
+ "for neighbor ID %s (%s)", inet_ntoa(nbr->id),
+ nbr->iface->name);
return (nbr_act_restart_dd(nbr));
}
ospfe_imsg_compose_rde(IMSG_DB_SNAPSHOT, nbr->peerid, 0, NULL, 0);
@@ -615,8 +620,9 @@ nbr_act_delete(struct nbr *nbr)
tv.tv_sec = DEFAULT_NBR_TMOUT;
if (evtimer_add(&nbr->inactivity_timer, &tv)) {
- log_warnx("nbr_act_delete: error scheduling neighbor ID %s "
- "for removal", inet_ntoa(nbr->id));
+ log_warnx("nbr_act_delete: error scheduling "
+ "neighbor ID %s (%s) for removal",
+ inet_ntoa(nbr->id), nbr->iface->name);
}
return (nbr_act_clear_lists(nbr));
@@ -640,7 +646,8 @@ nbr_act_clear_lists(struct nbr *nbr)
int
nbr_act_hello_check(struct nbr *nbr)
{
- log_debug("nbr_act_hello_check: neighbor ID %s", inet_ntoa(nbr->id));
+ log_debug("nbr_act_hello_check: neighbor ID %s (%s)",
+ inet_ntoa(nbr->id), nbr->iface->name);
return (-1);
}