2004-12-11 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* ospf_packet.c: (ospf_db_desc) Should be static, not global.
(ospf_hello,ospf_db_desc,ospf_ls_upd,ospf_ls_ack) Improve warning
messages to include identifying information (e.g. router id).
* ospf_nsm.c: (nsm_change_state) Improve info message to include
router id and state names.
diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog
index 4125655..82d0039 100644
--- a/ospfd/ChangeLog
+++ b/ospfd/ChangeLog
@@ -1,3 +1,11 @@
+2004-12-11 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+ * ospf_packet.c: (ospf_db_desc) Should be static, not global.
+ (ospf_hello,ospf_db_desc,ospf_ls_upd,ospf_ls_ack) Improve warning
+ messages to include identifying information (e.g. router id).
+ * ospf_nsm.c: (nsm_change_state) Improve info message to include
+ router id and state names.
+
2004-12-09 Greg Troxel <gdt@fnord.ir.bbn.com>
* ospf_apiserver.c (ospf_apiserver_term): Obtain struct
diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c
index e77546a..ce84624 100644
--- a/ospfd/ospf_nsm.c
+++ b/ospfd/ospf_nsm.c
@@ -689,7 +689,7 @@
/* One of the neighboring routers changes to/from the FULL state. */
if ((old_state != NSM_Full && state == NSM_Full) ||
(old_state == NSM_Full && state != NSM_Full))
- {
+ {
if (state == NSM_Full)
{
oi->full_nbrs++;
@@ -726,8 +726,11 @@
ospf_ls_retransmit_clear (nbr);
}
- zlog_info ("nsm_change_state(): "
- "scheduling new router-LSA origination");
+ zlog_info ("nsm_change_state(%s, %s -> %s): "
+ "scheduling new router-LSA origination",
+ inet_ntoa (nbr->router_id),
+ LOOKUP(ospf_nsm_state_msg, old_state),
+ LOOKUP(ospf_nsm_state_msg, state));
ospf_router_lsa_timer_add (oi->area);
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index 23b6a09..b4695f4 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -857,8 +857,8 @@
if (CHECK_FLAG (OPTIONS (oi), OSPF_OPTION_E) !=
CHECK_FLAG (hello->options, OSPF_OPTION_E))
{
- zlog_warn ("Packet[Hello:RECV]: my options: %x, his options %x",
- OPTIONS (oi), hello->options);
+ zlog_warn ("Packet %s [Hello:RECV]: my options: %x, his options %x",
+ inet_ntoa(ospfh->router_id), OPTIONS (oi), hello->options);
return;
}
@@ -1080,7 +1080,7 @@
}
/* OSPF Database Description message read -- RFC2328 Section 10.6. */
-void
+static void
ospf_db_desc (struct ip *iph, struct ospf_header *ospfh,
struct stream *s, struct ospf_interface *oi, u_int16_t size)
{
@@ -1103,7 +1103,9 @@
/* Check MTU. */
if (ntohs (dd->mtu) > oi->ifp->mtu)
{
- zlog_warn ("Packet[DD]: MTU is larger than [%s]'s MTU", IF_NAME (oi));
+ zlog_warn ("Packet[DD]: Neighbor %s MTU %u is larger than [%s]'s MTU %u",
+ inet_ntoa (nbr->router_id), ntohs (dd->mtu),
+ IF_NAME (oi), oi->ifp->mtu);
return;
}
@@ -1161,7 +1163,7 @@
case NSM_Attempt:
case NSM_TwoWay:
zlog_warn ("Packet[DD]: Neighbor %s state is %s, packet discarded.",
- inet_ntoa (ospfh->router_id),
+ inet_ntoa(nbr->router_id),
LOOKUP (ospf_nsm_state_msg, nbr->state));
break;
case NSM_Init:
@@ -1179,14 +1181,16 @@
if (IPV4_ADDR_CMP (&nbr->router_id, &oi->ospf->router_id) > 0)
{
/* We're Slave---obey */
- zlog_warn ("Packet[DD]: Negotiation done (Slave).");
+ zlog_warn ("Packet[DD]: Neighbor %s Negotiation done (Slave).",
+ inet_ntoa(nbr->router_id));
nbr->dd_seqnum = ntohl (dd->dd_seqnum);
nbr->dd_flags &= ~(OSPF_DD_FLAG_MS|OSPF_DD_FLAG_I); /* Reset I/MS */
}
else
{
/* We're Master, ignore the initial DBD from Slave */
- zlog_warn ("Packet[DD]: Initial DBD from Slave, ignoring.");
+ zlog_warn ("Packet[DD]: Neighbor %s: Initial DBD from Slave, "
+ "ignoring.", inet_ntoa(nbr->router_id));
break;
}
}
@@ -1195,12 +1199,14 @@
ntohl (dd->dd_seqnum) == nbr->dd_seqnum &&
IPV4_ADDR_CMP (&nbr->router_id, &oi->ospf->router_id) < 0)
{
- zlog_warn ("Packet[DD]: Negotiation done (Master).");
+ zlog_warn ("Packet[DD]: Neighbor %s Negotiation done (Master).",
+ inet_ntoa(nbr->router_id));
nbr->dd_flags &= ~OSPF_DD_FLAG_I;
}
else
{
- zlog_warn ("Packet[DD]: Negotiation fails.");
+ zlog_warn ("Packet[DD]: Neighbor %s Negotiation fails.",
+ inet_ntoa(nbr->router_id));
break;
}
@@ -1234,11 +1240,13 @@
{
if (IS_SET_DD_MS (nbr->dd_flags))
/* Master: discard duplicated DD packet. */
- zlog_warn ("Packet[DD] (Master): packet duplicated.");
+ zlog_warn ("Packet[DD] (Master): Neighbor %s packet duplicated.",
+ inet_ntoa (nbr->router_id));
else
/* Slave: cause to retransmit the last Database Description. */
{
- zlog_warn ("Packet[DD] [Slave]: packet duplicated.");
+ zlog_warn ("Packet[DD] [Slave]: Neighbor %s packet duplicated.",
+ inet_ntoa (nbr->router_id));
ospf_db_desc_resend (nbr);
}
break;
@@ -1248,18 +1256,20 @@
/* Check Master/Slave bit mismatch */
if (IS_SET_DD_MS (dd->flags) != IS_SET_DD_MS (nbr->last_recv.flags))
{
- zlog_warn ("Packet[DD]: MS-bit mismatch.");
+ zlog_warn ("Packet[DD]: Neighbor %s MS-bit mismatch.",
+ inet_ntoa(nbr->router_id));
OSPF_NSM_EVENT_SCHEDULE (nbr, NSM_SeqNumberMismatch);
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("Packet[DD]: dd->flags=%d, nbr->dd_flags=%d",
- dd->flags, nbr->dd_flags);
+ dd->flags, nbr->dd_flags);
break;
}
/* Check initialize bit is set. */
if (IS_SET_DD_I (dd->flags))
{
- zlog_warn ("Packet[DD]: I-bit set.");
+ zlog_warn ("Packet[DD]: Neighbor %s I-bit set.",
+ inet_ntoa(nbr->router_id));
OSPF_NSM_EVENT_SCHEDULE (nbr, NSM_SeqNumberMismatch);
break;
}
@@ -1271,7 +1281,8 @@
/* Save the new options for debugging */
nbr->options = dd->options;
#endif /* ORIGINAL_CODING */
- zlog_warn ("Packet[DD]: options mismatch.");
+ zlog_warn ("Packet[DD]: Neighbor %s options mismatch.",
+ inet_ntoa(nbr->router_id));
OSPF_NSM_EVENT_SCHEDULE (nbr, NSM_SeqNumberMismatch);
break;
}
@@ -1282,7 +1293,8 @@
(!IS_SET_DD_MS (nbr->dd_flags) &&
ntohl (dd->dd_seqnum) != nbr->dd_seqnum + 1))
{
- zlog_warn ("Packet[DD]: sequence number mismatch.");
+ zlog_warn ("Packet[DD]: Neighbor %s sequence number mismatch.",
+ inet_ntoa(nbr->router_id));
OSPF_NSM_EVENT_SCHEDULE (nbr, NSM_SeqNumberMismatch);
break;
}
@@ -1297,7 +1309,8 @@
if (IS_SET_DD_MS (nbr->dd_flags))
{
/* Master should discard duplicate DD packet. */
- zlog_warn ("Packet[DD]: duplicated, packet discarded.");
+ zlog_warn("Packet[DD]: Neighbor %s duplicated, packet discarded.",
+ inet_ntoa(nbr->router_id));
break;
}
else
@@ -1325,7 +1338,8 @@
OSPF_NSM_EVENT_SCHEDULE (nbr, NSM_SeqNumberMismatch);
break;
default:
- zlog_warn ("Packet[DD]: NSM illegal status.");
+ zlog_warn ("Packet[DD]: Neighbor %s NSM illegal status %u.",
+ inet_ntoa(nbr->router_id), nbr->state);
break;
}
}
@@ -1595,8 +1609,10 @@
/* Check neighbor state. */
if (nbr->state < NSM_Exchange)
{
- zlog_warn ("Link State Update: Neighbor[%s] state is less than Exchange",
- inet_ntoa (ospfh->router_id));
+ zlog_warn ("Link State Update: "
+ "Neighbor[%s] state %s is less than Exchange",
+ inet_ntoa (ospfh->router_id),
+ LOOKUP(ospf_nsm_state_msg, nbr->state));
return;
}
@@ -1708,7 +1724,8 @@
ospf_ls_ack_send (nbr, lsa);
/* Discard LSA. */
- zlog_warn ("Link State Update: LS age is equal to MaxAge.");
+ zlog_warn("Link State Update[%s]: LS age is equal to MaxAge.",
+ dump_lsa_key(lsa));
DISCARD_LSA (lsa, 3);
}
@@ -1818,7 +1835,8 @@
if (ospf_ls_request_lookup (nbr, lsa))
{
OSPF_NSM_EVENT_SCHEDULE (nbr, NSM_BadLSReq);
- zlog_warn ("LSA instance exists on Link state request list");
+ zlog_warn("LSA[%s] instance exists on Link state request list",
+ dump_lsa_key(lsa));
/* Clean list of LSAs. */
ospf_upd_list_clean (lsas);
@@ -1949,7 +1967,10 @@
if (nbr->state < NSM_Exchange)
{
- zlog_warn ("Link State Acknowledgment: State is less than Exchange.");
+ zlog_warn ("Link State Acknowledgment: "
+ "Neighbor[%s] state %s is less than Exchange",
+ inet_ntoa (ospfh->router_id),
+ LOOKUP(ospf_nsm_state_msg, nbr->state));
return;
}