summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--usr.sbin/ospfd/database.c73
-rw-r--r--usr.sbin/ospfd/lsack.c23
-rw-r--r--usr.sbin/ospfd/lsreq.c9
-rw-r--r--usr.sbin/ospfd/lsupdate.c24
-rw-r--r--usr.sbin/ospfd/neighbor.c28
-rw-r--r--usr.sbin/ospfd/packet.c11
12 files changed, 186 insertions, 142 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);
}
diff --git a/usr.sbin/ospfd/database.c b/usr.sbin/ospfd/database.c
index aaf1bb3c1a3..5bfcd7af64d 100644
--- a/usr.sbin/ospfd/database.c
+++ b/usr.sbin/ospfd/database.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: database.c,v 1.34 2019/07/15 18:26:39 remi Exp $ */
+/* $OpenBSD: database.c,v 1.35 2021/11/03 21:40:03 sthen Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -62,9 +62,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;
@@ -166,8 +166,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));
@@ -176,9 +176,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;
}
@@ -186,8 +187,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;
}
@@ -196,9 +198,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 */
@@ -212,10 +214,10 @@ recv_db_description(struct nbr *nbr, char *buf, u_int16_t len)
return;
nbr->capa_options = dd_hdr.opts;
if ((nbr->capa_options & nbr->options) != nbr->options) {
- log_warnx("recv_db_description: neighbor ID %s "
+ log_warnx("recv_db_description: neighbor ID %s (%s) "
"sent inconsistent options %x vs. %x",
- inet_ntoa(nbr->id), nbr->capa_options,
- nbr->options);
+ inet_ntoa(nbr->id), nbr->iface->name,
+ nbr->capa_options, nbr->options);
}
/*
* check bits: either I,M,MS or only M
@@ -235,10 +237,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++;
@@ -254,9 +256,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:
@@ -264,16 +267,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;
}
@@ -286,10 +290,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;
}
@@ -299,10 +303,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;
}
@@ -311,10 +315,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;
}
@@ -398,8 +402,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/ospfd/lsack.c b/usr.sbin/ospfd/lsack.c
index ca2a7f6a140..c996607b614 100644
--- a/usr.sbin/ospfd/lsack.c
+++ b/usr.sbin/ospfd/lsack.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lsack.c,v 1.22 2019/07/15 18:26:39 remi Exp $ */
+/* $OpenBSD: lsack.c,v 1.23 2021/11/03 21:40:03 sthen Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -111,8 +111,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:
@@ -133,7 +133,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;
@@ -147,8 +148,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);
}
@@ -161,15 +162,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/ospfd/lsreq.c b/usr.sbin/ospfd/lsreq.c
index 2c90e7cfca3..28e6dd8095a 100644
--- a/usr.sbin/ospfd/lsreq.c
+++ b/usr.sbin/ospfd/lsreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lsreq.c,v 1.22 2021/01/19 09:25:53 claudio Exp $ */
+/* $OpenBSD: lsreq.c,v 1.23 2021/11/03 21:40:03 sthen Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -99,8 +99,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:
@@ -212,7 +212,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/ospfd/lsupdate.c b/usr.sbin/ospfd/lsupdate.c
index b057d1c08fd..4b9c0aff05f 100644
--- a/usr.sbin/ospfd/lsupdate.c
+++ b/usr.sbin/ospfd/lsupdate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lsupdate.c,v 1.49 2021/01/19 09:25:53 claudio Exp $ */
+/* $OpenBSD: lsupdate.c,v 1.50 2021/11/03 21:40:03 sthen Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -238,8 +238,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));
@@ -255,8 +256,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:
@@ -264,13 +265,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,
@@ -280,7 +283,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;
@@ -491,8 +495,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);
TAILQ_REMOVE(&nbr->ls_retrans_list, le, entry);
nbr->ls_ret_cnt--;
le->le_when = nbr->iface->rxmt_interval;
diff --git a/usr.sbin/ospfd/neighbor.c b/usr.sbin/ospfd/neighbor.c
index b2c1df65bcb..205aa78c124 100644
--- a/usr.sbin/ospfd/neighbor.c
+++ b/usr.sbin/ospfd/neighbor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: neighbor.c,v 1.49 2019/11/19 09:55:55 remi Exp $ */
+/* $OpenBSD: neighbor.c,v 1.50 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);
}
@@ -217,10 +219,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) {
@@ -523,7 +526,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_NEIGHBOR_CAPA, nbr->peerid, 0,
@@ -616,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));
@@ -641,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);
}
diff --git a/usr.sbin/ospfd/packet.c b/usr.sbin/ospfd/packet.c
index 5f0627a8c32..613556a4cf6 100644
--- a/usr.sbin/ospfd/packet.c
+++ b/usr.sbin/ospfd/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.35 2021/01/19 16:01:39 claudio Exp $ */
+/* $OpenBSD: packet.c,v 1.36 2021/11/03 21:40:03 sthen Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -214,8 +214,13 @@ recv_packet(int fd, short event, void *bula)
}
if (auth_validate(buf, len, iface, nbr)) {
- log_warnx("recv_packet: authentication error, "
- "interface %s", iface->name);
+ if (nbr == NULL)
+ log_warnx("recv_packet: authentication error, "
+ "interface %s", iface->name);
+ else
+ log_warnx("recv_packet: authentication error, "
+ "neighbor ID %s interface %s",
+ inet_ntoa(nbr->id), iface->name);
return;
}