From 23d6702952841184d364a5520dbe6be7a1a5d14b Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Sun, 11 Jan 2009 12:14:27 +0100 Subject: [PATCH] Some fixes and update of OSPF debug messages --- proto/ospf/dbdes.c | 6 +++--- proto/ospf/iface.c | 2 +- proto/ospf/lsreq.c | 10 +++++----- proto/ospf/lsupd.c | 13 +++++++++---- proto/ospf/neighbor.c | 5 +++-- proto/ospf/topology.c | 6 +++--- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/proto/ospf/dbdes.c b/proto/ospf/dbdes.c index 7f181fb6..2c5077b9 100644 --- a/proto/ospf/dbdes.c +++ b/proto/ospf/dbdes.c @@ -148,7 +148,7 @@ ospf_dbdes_send(struct ospf_neighbor *n) OSPF_TRACE(D_PACKETS, "DB_DES (M) sent to %I via %s.", n->ip, ifa->iface->name); - DBG("DB_DES PS=%u, M=%u.", ntohl(pkt->ddseq), pkt->imms.bit.m); + DBG("DB_DES PS=%u, M=%u\n", ntohl(pkt->ddseq), pkt->imms.bit.m); if (!n->myimms.bit.ms) { @@ -210,7 +210,7 @@ ospf_dbdes_receive(struct ospf_dbdes_packet *ps, OSPF_TRACE(D_PACKETS, "Received dbdes from %I via %s.", n->ip, ifa->iface->name); - DBG("DB_DES PS=%u, M=%u SIZE=%u.", ntohl(ps->ddseq), ps->imms.bit.m, size); + DBG("DB_DES PS=%u, M=%u SIZE=%u\n", ntohl(ps->ddseq), ps->imms.bit.m, size); ospf_neigh_sm(n, INM_HELLOREC); @@ -349,7 +349,7 @@ ospf_dbdes_receive(struct ospf_dbdes_packet *ps, { OSPF_TRACE(D_PACKETS, "dbdes - sequence mismatch neighbor %I (full)", n->ip); - DBG("PS=%u, DDR=%u, DDS=%u", ntohl(ps->ddseq), n->ddr, n->dds); + DBG("PS=%u, DDR=%u, DDS=%u\n", ntohl(ps->ddseq), n->ddr, n->dds); ospf_neigh_sm(n, INM_SEQMIS); } break; diff --git a/proto/ospf/iface.c b/proto/ospf/iface.c index d5d068b1..a4c97413 100644 --- a/proto/ospf/iface.c +++ b/proto/ospf/iface.c @@ -230,7 +230,7 @@ ospf_iface_sm(struct ospf_iface *ifa, int event) { struct ospf_area *oa = ifa->oa; - DBG("SM on iface %s. Event is \"%s\".", ifa->iface->name, ospf_ism[event]); + DBG("SM on iface %s. Event is '%s'\n", ifa->iface->name, ospf_ism[event]); switch (event) { diff --git a/proto/ospf/lsreq.c b/proto/ospf/lsreq.c index 774efe20..f43a08fe 100644 --- a/proto/ospf/lsreq.c +++ b/proto/ospf/lsreq.c @@ -45,8 +45,8 @@ ospf_lsreq_send(struct ospf_neighbor *n) lsh->type = en->lsa.type; lsh->rt = htonl(en->lsa.rt); lsh->id = htonl(en->lsa.id); - DBG("Requesting %uth LSA: Type: %u, Id: %I, RT: %I\n", i, en->lsa.type, - en->lsa.id, en->lsa.rt); + DBG("Requesting %uth LSA: Type: %u, ID: %I, RT: %I, SN: 0x%x, Age %u\n", + i, en->lsa.type, en->lsa.id, en->lsa.rt, en->lsa.sn, en->lsa.age); lsh++; if (sn == STAIL(n->lsrql)) break; @@ -93,7 +93,7 @@ ospf_lsreq_receive(struct ospf_lsreq_packet *ps, { u32 hid = ntohl(lsh->id); u32 hrt = ntohl(lsh->rt); - DBG("Processing LSA: ID=%I, Type=%u, Router=%I\n", hid, lsh->type, hrt); + DBG("Processing requested LSA: Type: %u, ID: %I, RT: %I\n", lsh->type, hid, hrt); llsh = sl_alloc(upslab); llsh->lsh.id = hid; llsh->lsh.rt = hrt; @@ -103,8 +103,8 @@ ospf_lsreq_receive(struct ospf_lsreq_packet *ps, llsh->lsh.type) == NULL) { log(L_WARN - "Received bad LS req from: %I looking: RT: %I, ID: %I, Type: %u", - n->ip, hrt, hid, lsh->type); + "Received bad LS req from: %I looking: Type: %u, ID: %I, RT: %I", + n->ip, lsh->type, hid, hrt); ospf_neigh_sm(n, INM_BADLSREQ); rfree(upslab); return; diff --git a/proto/ospf/lsupd.c b/proto/ospf/lsupd.c index 9f7dd638..76d4e6ae 100644 --- a/proto/ospf/lsupd.c +++ b/proto/ospf/lsupd.c @@ -50,6 +50,10 @@ ospf_lsupd_flood(struct ospf_neighbor *n, struct ospf_lsa_header *hn, if (ifa->oa != oa) continue; } + + DBG("Wanted to flood LSA: Type: %u, ID: %I, RT: %I, SN: 0x%x, Age %u\n", + hh->type, hh->id, hh->rt, hh->sn, hh->age); + ret = 0; WALK_LIST(nn, ifa->neigh_list) { @@ -59,6 +63,8 @@ ospf_lsupd_flood(struct ospf_neighbor *n, struct ospf_lsa_header *hn, { if ((en = ospf_hash_find_header(nn->lsrqh, nn->ifa->oa->areaid, hh)) != NULL) { + DBG("That LSA found in lsreq list for neigh %I\n", nn->rid); + switch (lsa_comp(hh, &en->lsa)) { case CMP_OLDER: @@ -106,8 +112,7 @@ ospf_lsupd_flood(struct ospf_neighbor *n, struct ospf_lsa_header *hn, } s_add_tail(&nn->lsrtl, SNODE en); memcpy(&en->lsa, hh, sizeof(struct ospf_lsa_header)); - DBG("Adding LSA lsrt RT: %I, Id: %I, Type: %u for n: %I\n", - en->lsa.rt, en->lsa.id, en->lsa.type, nn->ip); + DBG("Adding that LSA for flood to %I\n", nn->ip); } else { @@ -245,8 +250,8 @@ ospf_lsupd_send_list(struct ospf_neighbor *n, list * l) continue; /* Probably flushed LSA */ /* FIXME This is a bug! I cannot flush LSA that is in lsrt */ - DBG("Sending ID=%I, Type=%u, RT=%I Sn: 0x%x Age: %u\n", - llsh->lsh.id, llsh->lsh.type, llsh->lsh.rt, en->lsa.sn, en->lsa.age); + DBG("Sending LSA: Type=%u, ID=%I, RT=%I, SN: 0x%x, Age: %u\n", + llsh->lsh.type, llsh->lsh.id, llsh->lsh.rt, en->lsa.sn, en->lsa.age); if (((u32) (len + en->lsa.length)) > ospf_pkt_maxsize(n->ifa)) { pk->lsano = htonl(lsano); diff --git a/proto/ospf/neighbor.c b/proto/ospf/neighbor.c index 7696d45e..b904874d 100644 --- a/proto/ospf/neighbor.c +++ b/proto/ospf/neighbor.c @@ -293,7 +293,7 @@ ospf_neigh_sm(struct ospf_neighbor *n, int event) struct proto_ospf *po = n->ifa->oa->po; struct proto *p = &po->proto; - DBG("Neighbor state machine for neighbor %I, event \"%s\".", n->ip, + DBG("Neighbor state machine for neighbor %I, event '%s'\n", n->ip, ospf_inm[event]); switch (event) @@ -600,10 +600,11 @@ void rxmt_timer_hook(timer * timer) { struct ospf_neighbor *n = (struct ospf_neighbor *) timer->data; + struct proto *p = &n->ifa->oa->po->proto; struct top_hash_entry *en; DBG("%s: RXMT timer fired on interface %s for neigh: %I.\n", - p->name, ifa->iface->name, n->ip); + p->name, n->ifa->iface->name, n->ip); if(n->state < NEIGHBOR_EXSTART) return; diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c index 9b2befbb..c3f70fd3 100644 --- a/proto/ospf/topology.c +++ b/proto/ospf/topology.c @@ -539,9 +539,9 @@ check_sum_lsa(struct proto_ospf *po, ort *nf, int dest) if ((nf->n.type > RTS_OSPF_IA) && (nf->o.type > RTS_OSPF_IA)) return; #ifdef LOCAL_DEBUG - DBG("Checking...dest = %d, %I/%d", dest, nf->fn.prefix, nf->fn.pxlen); - if (nf->n.oa) DBG("New: met=%d, oa=%d", nf->n.metric1, nf->n.oa->areaid); - if (nf->o.oa) DBG("Old: met=%d, oa=%d", nf->o.metric1, nf->o.oa->areaid); + DBG("Checking...dest = %d, %I/%d\n", dest, nf->fn.prefix, nf->fn.pxlen); + if (nf->n.oa) DBG("New: met=%d, oa=%d\n", nf->n.metric1, nf->n.oa->areaid); + if (nf->o.oa) DBG("Old: met=%d, oa=%d\n", nf->o.metric1, nf->o.oa->areaid); #endif WALK_LIST(oa, po->area_list)