Use %R in OSPF when appropriate.

This commit is contained in:
Ondrej Zajicek 2009-07-23 16:51:28 +02:00
parent 2f6483cd31
commit 3aab39f589
10 changed files with 98 additions and 110 deletions

View file

@ -115,8 +115,7 @@ ospf_dbdes_send(struct ospf_neighbor *n, int next)
{ {
htonlsah(&(en->lsa), lsa); htonlsah(&(en->lsa), lsa);
DBG("Working on: %d\n", i); DBG("Working on: %d\n", i);
DBG("\tX%01x %-1I %-1I %p\n", en->lsa.type, ipa_from_u32(en->lsa.id), DBG("\tX%01x %-1R %-1R %p\n", en->lsa.type, en->lsa.id, en->lsa.rt, en->lsa_body);
ipa_from_u32(en->lsa.rt), en->lsa_body);
lsa++; lsa++;
} }

View file

@ -112,8 +112,8 @@ ospf_iface_chstate(struct ospf_iface *ifa, u8 state)
if (ifa->type == OSPF_IT_VLINK) if (ifa->type == OSPF_IT_VLINK)
{ {
OSPF_TRACE(D_EVENTS, OSPF_TRACE(D_EVENTS,
"Changing state of virtual link %I from \"%s\" into \"%s\".", "Changing state of virtual link %R from \"%s\" into \"%s\".",
ipa_from_u32(ifa->vid), ospf_is[oldstate], ospf_is[state]); ifa->vid, ospf_is[oldstate], ospf_is[state]);
if (state == OSPF_IS_PTP) if (state == OSPF_IS_PTP)
{ {
ifa->ip_sk = ospf_open_ip_socket(ifa); ifa->ip_sk = ospf_open_ip_socket(ifa);
@ -586,8 +586,8 @@ ospf_iface_info(struct ospf_iface *ifa)
strict = ""; strict = "";
if (ifa->type == OSPF_IT_VLINK) if (ifa->type == OSPF_IT_VLINK)
{ {
cli_msg(-1015, "Virtual link to %I:", ipa_from_u32(ifa->vid)); cli_msg(-1015, "Virtual link to %R:", ifa->vid);
cli_msg(-1015, "\tTransit area: %I (%u)", ipa_from_u32(ifa->voa->areaid), cli_msg(-1015, "\tTransit area: %R (%u)", ifa->voa->areaid,
ifa->voa->areaid); ifa->voa->areaid);
} }
else else
@ -595,7 +595,7 @@ ospf_iface_info(struct ospf_iface *ifa)
cli_msg(-1015, "Interface \"%s\":", cli_msg(-1015, "Interface \"%s\":",
(ifa->iface ? ifa->iface->name : "(none)")); (ifa->iface ? ifa->iface->name : "(none)"));
cli_msg(-1015, "\tType: %s %s", ospf_it[ifa->type], strict); cli_msg(-1015, "\tType: %s %s", ospf_it[ifa->type], strict);
cli_msg(-1015, "\tArea: %I (%u)", ipa_from_u32(ifa->oa->areaid), ifa->oa->areaid); cli_msg(-1015, "\tArea: %R (%u)", ifa->oa->areaid, ifa->oa->areaid);
} }
cli_msg(-1015, "\tState: %s %s", ospf_is[ifa->state], cli_msg(-1015, "\tState: %s %s", ospf_is[ifa->state],
ifa->stub ? "(stub)" : ""); ifa->stub ? "(stub)" : "");
@ -612,9 +612,9 @@ ospf_iface_info(struct ospf_iface *ifa)
cli_msg(-1015, "\tRetransmit timer: %u", ifa->rxmtint); cli_msg(-1015, "\tRetransmit timer: %u", ifa->rxmtint);
if ((ifa->type == OSPF_IT_BCAST) || (ifa->type == OSPF_IT_NBMA)) if ((ifa->type == OSPF_IT_BCAST) || (ifa->type == OSPF_IT_NBMA))
{ {
cli_msg(-1015, "\tDesigned router (ID): %I", ipa_from_u32(ifa->drid)); cli_msg(-1015, "\tDesigned router (ID): %R", ifa->drid);
cli_msg(-1015, "\tDesigned router (IP): %I", ifa->drip); cli_msg(-1015, "\tDesigned router (IP): %I", ifa->drip);
cli_msg(-1015, "\tBackup designed router (ID): %I", ipa_from_u32(ifa->bdrid)); cli_msg(-1015, "\tBackup designed router (ID): %R", ifa->bdrid);
cli_msg(-1015, "\tBackup designed router (IP): %I", ifa->bdrip); cli_msg(-1015, "\tBackup designed router (IP): %I", ifa->bdrip);
} }
} }

View file

@ -42,8 +42,8 @@ ospf_lsack_enqueue(struct ospf_neighbor *n, struct ospf_lsa_header *h,
struct lsah_n *no = mb_alloc(n->pool, sizeof(struct lsah_n)); struct lsah_n *no = mb_alloc(n->pool, sizeof(struct lsah_n));
memcpy(&no->lsa, h, sizeof(struct ospf_lsa_header)); memcpy(&no->lsa, h, sizeof(struct ospf_lsa_header));
add_tail(&n->ackl[queue], NODE no); add_tail(&n->ackl[queue], NODE no);
DBG("Adding (%s) ack for %I, ID: %I, RT: %I, Type: %u\n", s_queue[queue], DBG("Adding (%s) ack for %R, ID: %R, RT: %R, Type: %u\n", s_queue[queue],
ipa_from_u32(n->rid), ipa_from_u32(ntohl(h->id)), ipa_from_u32(ntohl(h->rt)), h->type); n->rid, ntohl(h->id), ntohl(h->rt), h->type);
} }
void void
@ -77,8 +77,8 @@ ospf_lsack_send(struct ospf_neighbor *n, int queue)
no = (struct lsah_n *) HEAD(n->ackl[queue]); no = (struct lsah_n *) HEAD(n->ackl[queue]);
memcpy(h + i, &no->lsa, sizeof(struct ospf_lsa_header)); memcpy(h + i, &no->lsa, sizeof(struct ospf_lsa_header));
i++; i++;
DBG("Iter %u ID: %I, RT: %I, Type: %u\n", i, ipa_from_u32(ntohl((h + i)->id)), DBG("Iter %u ID: %R, RT: %R, Type: %u\n", i, ntohl((h + i)->id),
ipa_from_u32(ntohl((h + i)->rt)), (h + i)->type); ntohl((h + i)->rt), (h + i)->type);
rem_node(NODE no); rem_node(NODE no);
mb_free(no); mb_free(no);
if ((i * sizeof(struct ospf_lsa_header) + if ((i * sizeof(struct ospf_lsa_header) +
@ -181,8 +181,8 @@ ospf_lsack_receive(struct ospf_lsack_packet *ps,
continue; continue;
OSPF_TRACE(D_PACKETS, "Strange LS acknoledgement from %I", n->ip); OSPF_TRACE(D_PACKETS, "Strange LS acknoledgement from %I", n->ip);
OSPF_TRACE(D_PACKETS, "Id: %I, Rt: %I, Type: %u", OSPF_TRACE(D_PACKETS, "Id: %R, Rt: %R, Type: %u",
ipa_from_u32(lsa.id), ipa_from_u32(lsa.rt), lsa.type); lsa.id, lsa.rt, lsa.type);
OSPF_TRACE(D_PACKETS, "I have: Age: %4u, Seqno: 0x%08x, Sum: %u", OSPF_TRACE(D_PACKETS, "I have: Age: %4u, Seqno: 0x%08x, Sum: %u",
en->lsa.age, en->lsa.sn, en->lsa.checksum); en->lsa.age, en->lsa.sn, en->lsa.checksum);
OSPF_TRACE(D_PACKETS, "He has: Age: %4u, Seqno: 0x%08x, Sum: %u", OSPF_TRACE(D_PACKETS, "He has: Age: %4u, Seqno: 0x%08x, Sum: %u",
@ -190,8 +190,8 @@ ospf_lsack_receive(struct ospf_lsack_packet *ps,
continue; continue;
} }
DBG("Deleting LS Id: %I RT: %I Type: %u from LS Retl for neighbor %I\n", DBG("Deleting LS Id: %R RT: %R Type: %u from LS Retl for neighbor %R\n",
ipa_from_u32(lsa.id), ipa_from_u32(lsa.rt), lsa.type, ipa_from_u32(n->rid)); lsa.id, lsa.rt, lsa.type, n->rid);
s_rem_node(SNODE en); s_rem_node(SNODE en);
if (en->lsa_body != NULL) if (en->lsa_body != NULL)
mb_free(en->lsa_body); mb_free(en->lsa_body);

View file

@ -14,8 +14,8 @@ flush_lsa(struct top_hash_entry *en, struct proto_ospf *po)
struct proto *p = &po->proto; struct proto *p = &po->proto;
OSPF_TRACE(D_EVENTS, OSPF_TRACE(D_EVENTS,
"Going to remove node Type: %u, Id: %I, Rt: %I, Age: %u, SN: 0x%x", "Going to remove node Type: %u, Id: %R, Rt: %R, Age: %u, SN: 0x%x",
en->lsa.type, ipa_from_u32(en->lsa.id), ipa_from_u32(en->lsa.rt), en->lsa.age, en->lsa.sn); en->lsa.type, en->lsa.id, en->lsa.rt, en->lsa.age, en->lsa.sn);
s_rem_node(SNODE en); s_rem_node(SNODE en);
if (en->lsa_body != NULL) if (en->lsa_body != NULL)
mb_free(en->lsa_body); mb_free(en->lsa_body);
@ -56,8 +56,8 @@ ospf_age(struct proto_ospf *po)
en->nhi = NULL; en->nhi = NULL;
en->nh = IPA_NONE; en->nh = IPA_NONE;
en->lb = IPA_NONE; en->lb = IPA_NONE;
DBG("Infinitying Type: %u, Id: %I, Rt: %I\n", en->lsa.type, DBG("Infinitying Type: %u, Id: %R, Rt: %R\n", en->lsa.type,
ipa_from_u32(en->lsa.id), ipa_from_u32(en->lsa.rt)); en->lsa.id, en->lsa.rt);
} }
if (en->lsa.age == LSA_MAXAGE) if (en->lsa.age == LSA_MAXAGE)
{ {
@ -68,8 +68,8 @@ ospf_age(struct proto_ospf *po)
if ((en->lsa.rt == p->cf->global->router_id) &&(en->lsa.age >= if ((en->lsa.rt == p->cf->global->router_id) &&(en->lsa.age >=
LSREFRESHTIME)) LSREFRESHTIME))
{ {
OSPF_TRACE(D_EVENTS, "Refreshing my LSA: Type: %u, Id: %I, Rt: %I", OSPF_TRACE(D_EVENTS, "Refreshing my LSA: Type: %u, Id: %R, Rt: %R",
en->lsa.type, ipa_from_u32(en->lsa.id), ipa_from_u32(en->lsa.rt)); en->lsa.type, en->lsa.id, en->lsa.rt);
en->lsa.sn++; en->lsa.sn++;
en->lsa.age = 0; en->lsa.age = 0;
en->inst_t = now; en->inst_t = now;
@ -459,9 +459,8 @@ lsa_install_new(struct ospf_lsa_header *lsa, void *body, struct ospf_area *oa)
s_rem_node(SNODE en); s_rem_node(SNODE en);
} }
DBG("Inst lsa: Id: %I, Rt: %I, Type: %u, Age: %u, Sum: %u, Sn: 0x%x\n", DBG("Inst lsa: Id: %R, Rt: %R, Type: %u, Age: %u, Sum: %u, Sn: 0x%x\n",
ipa_from_u32(lsa->id), ipa_from_u32(lsa->rt), lsa->id, lsa->rt, lsa->type, lsa->age, lsa->checksum, lsa->sn);
lsa->type, lsa->age, lsa->checksum, lsa->sn);
s_add_tail(&po->lsal, SNODE en); s_add_tail(&po->lsal, SNODE en);
en->inst_t = now; en->inst_t = now;

View file

@ -22,9 +22,8 @@ static void ospf_dump_lsreq(struct proto *p, struct ospf_lsreq_packet *pkt)
sizeof(struct ospf_lsreq_header); sizeof(struct ospf_lsreq_header);
for (i = 0; i < j; i++) for (i = 0; i < j; i++)
log(L_TRACE "%s: LSR Id: %I, Rt: %I, Type: %u", log(L_TRACE "%s: LSR Id: %R, Rt: %R, Type: %u",
p->name, ipa_from_u32(htonl(plsr[i].id)), p->name, htonl(plsr[i].id), htonl(plsr[i].rt), plsr[i].type);
ipa_from_u32(htonl(plsr[i].rt)), plsr[i].type);
} }
void void
@ -64,8 +63,8 @@ ospf_lsreq_send(struct ospf_neighbor *n)
lsh->type = en->lsa.type; lsh->type = en->lsa.type;
lsh->rt = htonl(en->lsa.rt); lsh->rt = htonl(en->lsa.rt);
lsh->id = htonl(en->lsa.id); lsh->id = htonl(en->lsa.id);
DBG("Requesting %uth LSA: Type: %u, ID: %I, RT: %I, SN: 0x%x, Age %u\n", DBG("Requesting %uth LSA: Type: %u, ID: %R, RT: %R, SN: 0x%x, Age %u\n",
i, en->lsa.type, ipa_from_u32(en->lsa.id), ipa_from_u32(en->lsa.rt), en->lsa.sn, en->lsa.age); i, en->lsa.type, en->lsa.id, en->lsa.rt, en->lsa.sn, en->lsa.age);
lsh++; lsh++;
if (sn == STAIL(n->lsrql)) if (sn == STAIL(n->lsrql))
break; break;
@ -115,7 +114,7 @@ ospf_lsreq_receive(struct ospf_lsreq_packet *ps,
{ {
u32 hid = ntohl(lsh->id); u32 hid = ntohl(lsh->id);
u32 hrt = ntohl(lsh->rt); u32 hrt = ntohl(lsh->rt);
DBG("Processing requested LSA: Type: %u, ID: %I, RT: %I\n", lsh->type, ipa_from_u32(hid), ipa_from_u32(hrt)); DBG("Processing requested LSA: Type: %u, ID: %R, RT: %R\n", lsh->type, hid, hrt);
llsh = sl_alloc(upslab); llsh = sl_alloc(upslab);
llsh->lsh.id = hid; llsh->lsh.id = hid;
llsh->lsh.rt = hrt; llsh->lsh.rt = hrt;
@ -125,8 +124,8 @@ ospf_lsreq_receive(struct ospf_lsreq_packet *ps,
llsh->lsh.type) == NULL) llsh->lsh.type) == NULL)
{ {
log(L_WARN log(L_WARN
"Received bad LS req from: %I looking: Type: %u, ID: %I, RT: %I", "Received bad LS req from: %I looking: Type: %u, ID: %R, RT: %R",
n->ip, lsh->type, ipa_from_u32(hid), ipa_from_u32(hrt)); n->ip, lsh->type, hid, hrt);
ospf_neigh_sm(n, INM_BADLSREQ); ospf_neigh_sm(n, INM_BADLSREQ);
rfree(upslab); rfree(upslab);
return; return;

View file

@ -14,15 +14,14 @@ void ospf_dump_lsahdr(struct proto *p, struct ospf_lsa_header *lsa_n)
struct ospf_lsa_header lsa; struct ospf_lsa_header lsa;
ntohlsah(lsa_n, &lsa); ntohlsah(lsa_n, &lsa);
log(L_TRACE "%s: LSA Id: %I, Rt: %I, Type: %u, Age: %u, Seqno: 0x%08x, Sum: %u", log(L_TRACE "%s: LSA Id: %R, Rt: %R, Type: %u, Age: %u, Seqno: 0x%08x, Sum: %u",
p->name, ipa_from_u32(lsa.id), ipa_from_u32(lsa.rt), lsa.type, p->name, lsa.id, lsa.rt, lsa.type, lsa.age, lsa.sn, lsa.checksum);
lsa.age, lsa.sn, lsa.checksum);
} }
void ospf_dump_common(struct proto *p, struct ospf_packet *op) void ospf_dump_common(struct proto *p, struct ospf_packet *op)
{ {
log(L_TRACE "%s: length %d", p->name, ntohs(op->length)); log(L_TRACE "%s: length %d", p->name, ntohs(op->length));
log(L_TRACE "%s: router %I", p->name, ipa_from_u32(ntohl(op->routerid))); log(L_TRACE "%s: router %R", p->name, ntohl(op->routerid));
} }
static void ospf_dump_lsupd(struct proto *p, struct ospf_lsupd_packet *pkt) static void ospf_dump_lsupd(struct proto *p, struct ospf_lsupd_packet *pkt)
@ -95,8 +94,8 @@ ospf_lsupd_flood(struct ospf_neighbor *n, struct ospf_lsa_header *hn,
continue; continue;
} }
DBG("Wanted to flood LSA: Type: %u, ID: %I, RT: %I, SN: 0x%x, Age %u\n", DBG("Wanted to flood LSA: Type: %u, ID: %R, RT: %R, SN: 0x%x, Age %u\n",
hh->type, ipa_from_u32(hh->id), ipa_from_u32(hh->rt), hh->sn, hh->age); hh->type, hh->id, hh->rt, hh->sn, hh->age);
ret = 0; ret = 0;
WALK_LIST(nn, ifa->neigh_list) WALK_LIST(nn, ifa->neigh_list)
@ -107,7 +106,7 @@ 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) 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", ipa_from_u32(nn->rid)); DBG("That LSA found in lsreq list for neigh %R\n", nn->rid);
switch (lsa_comp(hh, &en->lsa)) switch (lsa_comp(hh, &en->lsa))
{ {
@ -119,7 +118,7 @@ ospf_lsupd_flood(struct ospf_neighbor *n, struct ospf_lsa_header *hn,
if (en->lsa_body != NULL) if (en->lsa_body != NULL)
mb_free(en->lsa_body); mb_free(en->lsa_body);
en->lsa_body = NULL; en->lsa_body = NULL;
DBG("Removing from lsreq list for neigh %I\n", ipa_from_u32(nn->rid)); DBG("Removing from lsreq list for neigh %R\n", nn->rid);
ospf_hash_delete(nn->lsrqh, en); ospf_hash_delete(nn->lsrqh, en);
if (EMPTY_SLIST(nn->lsrql)) if (EMPTY_SLIST(nn->lsrql))
ospf_neigh_sm(nn, INM_LOADDONE); ospf_neigh_sm(nn, INM_LOADDONE);
@ -130,7 +129,7 @@ ospf_lsupd_flood(struct ospf_neighbor *n, struct ospf_lsa_header *hn,
if (en->lsa_body != NULL) if (en->lsa_body != NULL)
mb_free(en->lsa_body); mb_free(en->lsa_body);
en->lsa_body = NULL; en->lsa_body = NULL;
DBG("Removing from lsreq list for neigh %I\n", ipa_from_u32(nn->rid)); DBG("Removing from lsreq list for neigh %R\n", nn->rid);
ospf_hash_delete(nn->lsrqh, en); ospf_hash_delete(nn->lsrqh, en);
if (EMPTY_SLIST(nn->lsrql)) if (EMPTY_SLIST(nn->lsrql))
ospf_neigh_sm(nn, INM_LOADDONE); ospf_neigh_sm(nn, INM_LOADDONE);
@ -294,9 +293,8 @@ ospf_lsupd_send_list(struct ospf_neighbor *n, list * l)
continue; /* Probably flushed LSA */ continue; /* Probably flushed LSA */
/* FIXME This is a bug! I cannot flush LSA that is in lsrt */ /* FIXME This is a bug! I cannot flush LSA that is in lsrt */
DBG("Sending LSA: Type=%u, ID=%I, RT=%I, SN: 0x%x, Age: %u\n", DBG("Sending LSA: Type=%u, ID=%R, RT=%R, SN: 0x%x, Age: %u\n",
llsh->lsh.type, ipa_from_u32(llsh->lsh.id), ipa_from_u32(llsh->lsh.rt), llsh->lsh.type, llsh->lsh.id, llsh->lsh.rt, en->lsa.sn, en->lsa.age);
en->lsa.sn, en->lsa.age);
if (((u32) (len + en->lsa.length)) > ospf_pkt_maxsize(n->ifa)) if (((u32) (len + en->lsa.length)) > ospf_pkt_maxsize(n->ifa))
{ {
pk->lsano = htonl(lsano); pk->lsano = htonl(lsano);
@ -347,9 +345,7 @@ ospf_lsupd_receive(struct ospf_lsupd_packet *ps,
if (n->state < NEIGHBOR_EXCHANGE) if (n->state < NEIGHBOR_EXCHANGE)
{ {
OSPF_TRACE(D_PACKETS, OSPF_TRACE(D_PACKETS, "Received lsupd in lesser state than EXCHANGE from (%I)", n->ip);
"Received lsupd in lesser state than EXCHANGE from (%I)",
n->ip);
return; return;
} }
@ -414,16 +410,15 @@ ospf_lsupd_receive(struct ospf_lsupd_packet *ps,
ntohlsah(lsa, &lsatmp); ntohlsah(lsa, &lsatmp);
DBG("Update Type: %u ID: %I RT: %I, Sn: 0x%08x Age: %u, Sum: %u\n", DBG("Update Type: %u ID: %R RT: %R, Sn: 0x%08x Age: %u, Sum: %u\n",
lsatmp.type, ipa_from_u32(lsatmp.id), ipa_from_u32(lsatmp.rt), lsatmp.type, lsatmp.id, lsatmp.rt, lsatmp.sn, lsatmp.age, lsatmp.checksum);
lsatmp.sn, lsatmp.age, lsatmp.checksum);
lsadb = ospf_hash_find_header(po->gr, oa->areaid, &lsatmp); lsadb = ospf_hash_find_header(po->gr, oa->areaid, &lsatmp);
#ifdef LOCAL_DEBUG #ifdef LOCAL_DEBUG
if (lsadb) if (lsadb)
DBG("I have Type: %u ID: %I RT: %I, Sn: 0x%08x Age: %u, Sum: %u\n", DBG("I have Type: %u ID: %R RT: %R, Sn: 0x%08x Age: %u, Sum: %u\n",
lsadb->lsa.type, ipa_from_u32(lsadb->lsa.id), ipa_from_u32(lsadb->lsa.rt), lsadb->lsa.type, lsadb->lsa.id, lsadb->lsa.rt,
lsadb->lsa.sn, lsadb->lsa.age, lsadb->lsa.checksum); lsadb->lsa.sn, lsadb->lsa.age, lsadb->lsa.checksum);
#endif #endif
@ -474,8 +469,8 @@ ospf_lsupd_receive(struct ospf_lsupd_packet *ps,
lsa->age = htons(LSA_MAXAGE); lsa->age = htons(LSA_MAXAGE);
lsa->sn = htonl(LSA_MAXSEQNO); lsa->sn = htonl(LSA_MAXSEQNO);
OSPF_TRACE(D_EVENTS, "Premature aging self originated lsa."); OSPF_TRACE(D_EVENTS, "Premature aging self originated lsa.");
OSPF_TRACE(D_EVENTS, "Type: %d, Id: %I, Rt: %I", lsatmp.type, OSPF_TRACE(D_EVENTS, "Type: %d, Id: %R, Rt: %R",
ipa_from_u32(lsatmp.id), ipa_from_u32(lsatmp.rt)); lsatmp.type, lsatmp.id, lsatmp.rt);
lsasum_check(lsa, (lsa + 1)); /* It also calculates chsum! */ lsasum_check(lsa, (lsa + 1)); /* It also calculates chsum! */
lsatmp.checksum = ntohs(lsa->checksum); lsatmp.checksum = ntohs(lsa->checksum);
ospf_lsupd_flood(NULL, lsa, &lsatmp, NULL, oa, 0); ospf_lsupd_flood(NULL, lsa, &lsatmp, NULL, oa, 0);
@ -611,7 +606,6 @@ ospf_lsupd_flush_nlsa(struct top_hash_entry *en, struct ospf_area *oa)
lsa->sn = LSA_MAXSEQNO; lsa->sn = LSA_MAXSEQNO;
lsasum_calculate(lsa, en->lsa_body); lsasum_calculate(lsa, en->lsa_body);
OSPF_TRACE(D_EVENTS, "Premature aging self originated lsa!"); OSPF_TRACE(D_EVENTS, "Premature aging self originated lsa!");
OSPF_TRACE(D_EVENTS, "Type: %d, Id: %I, Rt: %I", lsa->type, OSPF_TRACE(D_EVENTS, "Type: %d, Id: %R, Rt: %R", lsa->type, lsa->id, lsa->rt);
ipa_from_u32(lsa->id), ipa_from_u32(lsa->rt));
ospf_lsupd_flood(NULL, NULL, lsa, NULL, oa, 0); ospf_lsupd_flood(NULL, NULL, lsa, NULL, oa, 0);
} }

View file

@ -506,7 +506,7 @@ bdr_election(struct ospf_iface *ifa)
ifa->bdrip = nbdr->ip; ifa->bdrip = nbdr->ip;
} }
DBG("DR=%I, BDR=%I\n", ipa_from_u32(ifa->drid), ipa_from_u32(ifa->bdrid)); DBG("DR=%R, BDR=%R\n", ifa->drid, ifa->bdrid);
if (myid == ifa->drid) if (myid == ifa->drid)
ospf_iface_chstate(ifa, OSPF_IS_DR); ospf_iface_chstate(ifa, OSPF_IS_DR);
@ -624,7 +624,7 @@ ospf_sh_neigh_info(struct ospf_neighbor *n)
if ((n->ifa->type == OSPF_IT_PTP) || (n->ifa->type == OSPF_IT_VLINK)) if ((n->ifa->type == OSPF_IT_PTP) || (n->ifa->type == OSPF_IT_VLINK))
pos = "ptp "; pos = "ptp ";
cli_msg(-1013, "%-1I\t%3u\t%s/%s\t%-5s\t%-1I\t%-10s", ipa_from_u32(n->rid), n->priority, cli_msg(-1013, "%-1R\t%3u\t%s/%s\t%-5s\t%-1I\t%-10s", n->rid, n->priority,
ospf_ns[n->state], pos, etime, n->ip, ospf_ns[n->state], pos, etime, n->ip,
(ifa->type == OSPF_IT_VLINK ? "vlink" : ifa->iface->name)); (ifa->type == OSPF_IT_VLINK ? "vlink" : ifa->iface->name));
} }
@ -672,8 +672,8 @@ rxmt_timer_hook(timer * timer)
llsh->lsh.id = en->lsa.id; llsh->lsh.id = en->lsa.id;
llsh->lsh.rt = en->lsa.rt; llsh->lsh.rt = en->lsa.rt;
llsh->lsh.type = en->lsa.type; llsh->lsh.type = en->lsa.type;
DBG("Working on ID: %I, RT: %I, Type: %u\n", DBG("Working on ID: %R, RT: %R, Type: %u\n",
ipa_from_u32(en->lsa.id), ipa_from_u32(en->lsa.rt), en->lsa.type); en->lsa.id, en->lsa.rt, en->lsa.type);
add_tail(&uplist, NODE llsh); add_tail(&uplist, NODE llsh);
} }
ospf_lsupd_send_list(n, &uplist); ospf_lsupd_send_list(n, &uplist);

View file

@ -209,11 +209,11 @@ ospf_dump(struct proto *p)
{ {
OSPF_TRACE(D_EVENTS, "Interface: %s", (ifa->iface ? ifa->iface->name : "(null)")); OSPF_TRACE(D_EVENTS, "Interface: %s", (ifa->iface ? ifa->iface->name : "(null)"));
OSPF_TRACE(D_EVENTS, "state: %u", ifa->state); OSPF_TRACE(D_EVENTS, "state: %u", ifa->state);
OSPF_TRACE(D_EVENTS, "DR: %I", ipa_from_u32(ifa->drid)); OSPF_TRACE(D_EVENTS, "DR: %R", ifa->drid);
OSPF_TRACE(D_EVENTS, "BDR: %I", ipa_from_u32(ifa->bdrid)); OSPF_TRACE(D_EVENTS, "BDR: %R", ifa->bdrid);
WALK_LIST(n, ifa->neigh_list) WALK_LIST(n, ifa->neigh_list)
{ {
OSPF_TRACE(D_EVENTS, " neighbor %I in state %u", ipa_from_u32(n->rid), n->state); OSPF_TRACE(D_EVENTS, " neighbor %R in state %u", n->rid, n->state);
} }
} }
@ -309,8 +309,7 @@ schedule_rt_lsa(struct ospf_area *oa)
{ {
struct proto *p = &oa->po->proto; struct proto *p = &oa->po->proto;
OSPF_TRACE(D_EVENTS, "Scheduling RT lsa origination for area %I.", OSPF_TRACE(D_EVENTS, "Scheduling RT lsa origination for area %R.", oa->areaid);
ipa_from_u32(oa->areaid));
oa->origrt = 1; oa->origrt = 1;
} }
@ -953,7 +952,7 @@ ospf_sh(struct proto *p)
WALK_LIST(oa, po->area_list) WALK_LIST(oa, po->area_list)
{ {
cli_msg(-1014, "\tArea: %I (%u) %s", ipa_from_u32(oa->areaid), oa->areaid, cli_msg(-1014, "\tArea: %R (%u) %s", oa->areaid, oa->areaid,
oa->areaid == 0 ? "[BACKBONE]" : ""); oa->areaid == 0 ? "[BACKBONE]" : "");
ifano = 0; ifano = 0;
nno = 0; nno = 0;
@ -1088,7 +1087,7 @@ show_lsa_router(struct top_hash_entry *he)
for (i = 0; i < rt->links; i++) for (i = 0; i < rt->links; i++)
if (rr[i].type == LSART_PTP) if (rr[i].type == LSART_PTP)
cli_msg(-1016, "\t\trouter %I metric %u ", ipa_from_u32(rr[i].id), rr[i].metric); cli_msg(-1016, "\t\trouter %R metric %u ", rr[i].id, rr[i].metric);
for (i = 0; i < rt->links; i++) for (i = 0; i < rt->links; i++)
if (rr[i].type == LSART_NET) if (rr[i].type == LSART_NET)
@ -1125,10 +1124,10 @@ show_lsa_network(struct top_hash_entry *he)
cli_msg(-1016, ""); cli_msg(-1016, "");
cli_msg(-1016, "\tnetwork %I/%d", ipa_and(ipa_from_u32(lsa->id), ln->netmask), ipa_mklen(ln->netmask)); cli_msg(-1016, "\tnetwork %I/%d", ipa_and(ipa_from_u32(lsa->id), ln->netmask), ipa_mklen(ln->netmask));
cli_msg(-1016, "\t\tdr %I", ipa_from_u32(lsa->rt)); cli_msg(-1016, "\t\tdr %R", lsa->rt);
for (i = 0; i < max; i++) for (i = 0; i < max; i++)
cli_msg(-1016, "\t\trouter %I", ipa_from_u32(rts[i])); cli_msg(-1016, "\t\trouter %R", rts[i]);
} }
static inline void static inline void
@ -1143,7 +1142,7 @@ show_lsa_sum_net(struct top_hash_entry *he)
static inline void static inline void
show_lsa_sum_rt(struct top_hash_entry *he) show_lsa_sum_rt(struct top_hash_entry *he)
{ {
cli_msg(-1016, "\t\txrouter %I", ipa_from_u32(he->lsa.id)); cli_msg(-1016, "\t\txrouter %R", he->lsa.id);
} }
@ -1207,7 +1206,7 @@ ospf_sh_state(struct proto *p, int verbose)
if (last_area != hea[i]->oa->areaid) if (last_area != hea[i]->oa->areaid)
{ {
cli_msg(-1016, ""); cli_msg(-1016, "");
cli_msg(-1016, "area %I", ipa_from_u32(hea[i]->oa->areaid)); cli_msg(-1016, "area %R", hea[i]->oa->areaid);
last_area = hea[i]->oa->areaid; last_area = hea[i]->oa->areaid;
last_rt = 0xFFFFFFFF; last_rt = 0xFFFFFFFF;
} }
@ -1215,7 +1214,7 @@ ospf_sh_state(struct proto *p, int verbose)
if ((hea[i]->lsa.rt != last_rt) && (hea[i]->lsa.type != LSA_T_NET)) if ((hea[i]->lsa.rt != last_rt) && (hea[i]->lsa.type != LSA_T_NET))
{ {
cli_msg(-1016, ""); cli_msg(-1016, "");
cli_msg(-1016, (hea[i]->lsa.type != LSA_T_EXT) ? "\trouter %I" : "\txrouter %I", ipa_from_u32(hea[i]->lsa.rt)); cli_msg(-1016, (hea[i]->lsa.type != LSA_T_EXT) ? "\trouter %R" : "\txrouter %R", hea[i]->lsa.rt);
last_rt = hea[i]->lsa.rt; last_rt = hea[i]->lsa.rt;
} }

View file

@ -154,8 +154,7 @@ ospf_rt_spfa(struct ospf_area *oa)
if (oa->rt == NULL) if (oa->rt == NULL)
return; return;
OSPF_TRACE(D_EVENTS, "Starting routing table calculation for area %I", OSPF_TRACE(D_EVENTS, "Starting routing table calculation for area %R", oa->areaid);
ipa_from_u32(oa->areaid));
if (oa->rt->dist != LSINFINITY) if (oa->rt->dist != LSINFINITY)
bug("Aging was not processed."); bug("Aging was not processed.");
@ -168,8 +167,8 @@ ospf_rt_spfa(struct ospf_area *oa)
oa->rt->dist = 0; oa->rt->dist = 0;
oa->rt->color = CANDIDATE; oa->rt->color = CANDIDATE;
add_head(&oa->cand, &oa->rt->cn); add_head(&oa->cand, &oa->rt->cn);
DBG("RT LSA: rt: %I, id: %I, type: %u\n", ipa_from_u32(oa->rt->lsa.rt), DBG("RT LSA: rt: %R, id: %R, type: %u\n",
ipa_from_u32(oa->rt->lsa.id), oa->rt->lsa.type); oa->rt->lsa.rt, oa->rt->lsa.id, oa->rt->lsa.type);
while (!EMPTY_LIST(oa->cand)) while (!EMPTY_LIST(oa->cand))
{ {
@ -177,8 +176,8 @@ ospf_rt_spfa(struct ospf_area *oa)
act = SKIP_BACK(struct top_hash_entry, cn, n); act = SKIP_BACK(struct top_hash_entry, cn, n);
rem_node(n); rem_node(n);
DBG("Working on LSA: rt: %I, id: %I, type: %u\n", ipa_from_u32(act->lsa.rt), DBG("Working on LSA: rt: %R, id: %R, type: %u\n",
ipa_from_u32(act->lsa.id), act->lsa.type); act->lsa.rt, act->lsa.id, act->lsa.type);
act->color = INSPF; act->color = INSPF;
switch (act->lsa.type) switch (act->lsa.type)
@ -208,7 +207,7 @@ ospf_rt_spfa(struct ospf_area *oa)
{ {
tmp = NULL; tmp = NULL;
rtl = (rr + i); rtl = (rr + i);
DBG(" Working on link: %I (type: %u) ", ipa_from_u32(rtl->id), rtl->type); DBG(" Working on link: %R (type: %u) ", rtl->id, rtl->type);
switch (rtl->type) switch (rtl->type)
{ {
case LSART_STUB: case LSART_STUB:
@ -265,7 +264,7 @@ ospf_rt_spfa(struct ospf_area *oa)
DBG("PTP found.\n"); DBG("PTP found.\n");
break; break;
default: default:
log("Unknown link type in router lsa. (rid = %I)", ipa_from_u32(act->lsa.id)); log("Unknown link type in router lsa. (rid = %R)", act->lsa.id);
break; break;
} }
if (tmp) if (tmp)
@ -292,7 +291,7 @@ ospf_rt_spfa(struct ospf_area *oa)
for (i = 0; i < (act->lsa.length - sizeof(struct ospf_lsa_header) - for (i = 0; i < (act->lsa.length - sizeof(struct ospf_lsa_header) -
sizeof(struct ospf_lsa_net)) / sizeof(u32); i++) sizeof(struct ospf_lsa_net)) / sizeof(u32); i++)
{ {
DBG(" Working on router %I ", ipa_from_u32(rts[i])); DBG(" Working on router %R ", rts[i]);
tmp = ospf_hash_find(po->gr, oa->areaid, rts[i], rts[i], LSA_T_RT); tmp = ospf_hash_find(po->gr, oa->areaid, rts[i], rts[i], LSA_T_RT);
if (tmp != NULL) if (tmp != NULL)
DBG("Found :-)\n"); DBG("Found :-)\n");
@ -314,7 +313,7 @@ ospf_rt_spfa(struct ospf_area *oa)
{ {
if ((iface->state != OSPF_IS_PTP) || (iface->iface != tmp->nhi->iface) || (!ipa_equal(iface->vip, tmp->lb))) if ((iface->state != OSPF_IS_PTP) || (iface->iface != tmp->nhi->iface) || (!ipa_equal(iface->vip, tmp->lb)))
{ {
OSPF_TRACE(D_EVENTS, "Vlink peer %I found", ipa_from_u32(tmp->lsa.id)); OSPF_TRACE(D_EVENTS, "Vlink peer %R found", tmp->lsa.id);
ospf_iface_sm(iface, ISM_DOWN); ospf_iface_sm(iface, ISM_DOWN);
iface->iface = tmp->nhi->iface; iface->iface = tmp->nhi->iface;
iface->vip = tmp->lb; iface->vip = tmp->lb;
@ -325,7 +324,7 @@ ospf_rt_spfa(struct ospf_area *oa)
{ {
if (iface->state > OSPF_IS_DOWN) if (iface->state > OSPF_IS_DOWN)
{ {
OSPF_TRACE(D_EVENTS, "Vlink peer %I lost", ipa_from_u32(iface->vid)); OSPF_TRACE(D_EVENTS, "Vlink peer %R lost", iface->vid);
ospf_iface_sm(iface, ISM_DOWN); ospf_iface_sm(iface, ISM_DOWN);
} }
} }
@ -372,7 +371,7 @@ link_back(struct ospf_area *oa, struct top_hash_entry *fol, struct top_hash_entr
} }
break; break;
default: default:
log("Unknown link type in router lsa. (rid = %I)", ipa_from_u32(fol->lsa.id)); log("Unknown link type in router lsa. (rid = %R)", fol->lsa.id);
break; break;
} }
} }
@ -390,7 +389,7 @@ link_back(struct ospf_area *oa, struct top_hash_entry *fol, struct top_hash_entr
} }
break; break;
default: default:
bug("Unknown lsa type. (id = %I)", ipa_from_u32(fol->lsa.id)); bug("Unknown lsa type. (id = %R)", fol->lsa.id);
} }
return 0; return 0;
} }
@ -480,7 +479,7 @@ ospf_rt_sum(struct ospf_area *oa)
int mlen = -1, type = -1; int mlen = -1, type = -1;
union ospf_lsa_sum_tm *tm; union ospf_lsa_sum_tm *tm;
OSPF_TRACE(D_EVENTS, "Starting routing table calculation for inter-area (area %I)", ipa_from_u32(oa->areaid)); OSPF_TRACE(D_EVENTS, "Starting routing table calculation for inter-area (area %R)", oa->areaid);
WALK_SLIST(en, po->lsal) WALK_SLIST(en, po->lsal)
{ {
@ -663,9 +662,8 @@ ospf_ext_spf(struct proto_ospf *po)
le = en->lsa_body; le = en->lsa_body;
lt = (struct ospf_lsa_ext_tos *) (le + 1); lt = (struct ospf_lsa_ext_tos *) (le + 1);
DBG("%s: Working on LSA. ID: %I, RT: %I, Type: %u, Mask %I\n", DBG("%s: Working on LSA. ID: %R, RT: %R, Type: %u, Mask %I\n",
p->name, ipa_from_u32(en->lsa.id), ipa_from_u32(en->lsa.rt), p->name, en->lsa.id, en->lsa.rt, en->lsa.type, le->netmask);
en->lsa.type, le->netmask);
if ((lt->etm.metric & METRIC_MASK) == LSINFINITY) if ((lt->etm.metric & METRIC_MASK) == LSINFINITY)
continue; continue;
@ -673,9 +671,8 @@ ospf_ext_spf(struct proto_ospf *po)
mlen = ipa_mklen(le->netmask); mlen = ipa_mklen(le->netmask);
if ((mlen < 0) || (mlen > 32)) if ((mlen < 0) || (mlen > 32))
{ {
log("%s: Invalid mask in LSA. ID: %I, RT: %I, Type: %u, Mask %I", log("%s: Invalid mask in LSA. ID: %R, RT: %R, Type: %u, Mask %I",
p->name, ipa_from_u32(en->lsa.id), ipa_from_u32(en->lsa.rt), p->name, en->lsa.id, en->lsa.rt, en->lsa.type, le->netmask);
en->lsa.type, le->netmask);
continue; continue;
} }
nhi = NULL; nhi = NULL;
@ -798,8 +795,8 @@ add_cand(list * l, struct top_hash_entry *en, struct top_hash_entry *par,
if (!link_back(oa, en, par)) if (!link_back(oa, en, par))
return; return;
DBG(" Adding candidate: rt: %I, id: %I, type: %u\n", DBG(" Adding candidate: rt: %R, id: %R, type: %u\n",
ipa_from_u32(en->lsa.rt), ipa_from_u32(en->lsa.id), en->lsa.type); en->lsa.rt, en->lsa.id, en->lsa.type);
en->nhi = NULL; en->nhi = NULL;
en->nh = IPA_NONE; en->nh = IPA_NONE;
@ -861,8 +858,8 @@ calc_next_hop(struct top_hash_entry *en, struct top_hash_entry *par,
if (ipa_equal(par->nh, IPA_NONE)) if (ipa_equal(par->nh, IPA_NONE))
{ {
neighbor *nn; neighbor *nn;
DBG(" Next hop calculating for id: %I rt: %I type: %u\n", DBG(" Next hop calculating for id: %R rt: %R type: %u\n",
ipa_from_u32(en->lsa.id), ipa_from_u32(en->lsa.rt), en->lsa.type); en->lsa.id, en->lsa.rt, en->lsa.type);
if (par == oa->rt) if (par == oa->rt)
{ {
@ -916,8 +913,8 @@ calc_next_hop(struct top_hash_entry *en, struct top_hash_entry *par,
} }
else else
{ /* Parent is some RT neighbor */ { /* Parent is some RT neighbor */
log(L_ERR "Router's parent has no next hop. (EN=%I, PAR=%I)", log(L_ERR "Router's parent has no next hop. (EN=%R, PAR=%R)",
ipa_from_u32(en->lsa.id), ipa_from_u32(par->lsa.id)); en->lsa.id, par->lsa.id);
/* I hope this would never happen */ /* I hope this would never happen */
return; return;
} }

View file

@ -82,8 +82,8 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 * length)
struct ospf_lsa_rt_link *ln; struct ospf_lsa_rt_link *ln;
struct ospf_neighbor *neigh; struct ospf_neighbor *neigh;
DBG("%s: Originating RT_lsa body for area \"%I\".\n", po->proto.name, DBG("%s: Originating RT_lsa body for area %R.\n", po->proto.name,
ipa_from_u32(oa->areaid)); oa->areaid);
ASSERT(po->lsab_used == 0); ASSERT(po->lsab_used == 0);
rt = lsab_allocz(po, sizeof(struct ospf_lsa_rt)); rt = lsab_allocz(po, sizeof(struct ospf_lsa_rt));
@ -244,7 +244,7 @@ originate_rt_lsa(struct ospf_area *oa)
* try to do it next tick. * try to do it next tick.
*/ */
OSPF_TRACE(D_EVENTS, "Originating RT_lsa for area \"%I\".", ipa_from_u32(oa->areaid)); OSPF_TRACE(D_EVENTS, "Originating RT_lsa for area %R.", oa->areaid);
lsa.age = 0; lsa.age = 0;
lsa.id = rtid; lsa.id = rtid;
@ -464,8 +464,8 @@ flush_sum_lsa(struct ospf_area *oa, struct fib_node *fn, int type)
en->lsa.age = LSA_MAXAGE; en->lsa.age = LSA_MAXAGE;
en->lsa.sn = LSA_MAXSEQNO; en->lsa.sn = LSA_MAXSEQNO;
lsasum_calculate(&en->lsa, sum); lsasum_calculate(&en->lsa, sum);
OSPF_TRACE(D_EVENTS, "Flushing summary lsa. (id=%I, type=%d)", OSPF_TRACE(D_EVENTS, "Flushing summary lsa. (id=%R, type=%d)",
ipa_from_u32(en->lsa.id), en->lsa.type); en->lsa.id, en->lsa.type);
ospf_lsupd_flood(NULL, NULL, &en->lsa, NULL, oa, 1); ospf_lsupd_flood(NULL, NULL, &en->lsa, NULL, oa, 1);
if (can_flush_lsa(po)) flush_lsa(en, po); if (can_flush_lsa(po)) flush_lsa(en, po);
break; break;
@ -914,9 +914,9 @@ ospf_dump_lsa(struct top_hash_entry *he, struct proto *p)
u32 *rts = NULL; u32 *rts = NULL;
u32 i, max; u32 i, max;
OSPF_TRACE(D_EVENTS, "- %1x %-1I %-1I %4u 0x%08x 0x%04x %-1I", OSPF_TRACE(D_EVENTS, "- %1x %-1R %-1R %4u 0x%08x 0x%04x %-1R",
he->lsa.type, ipa_from_u32(he->lsa.id), ipa_from_u32(he->lsa.rt), he->lsa.type, he->lsa.id, he->lsa.rt, he->lsa.age, he->lsa.sn,
he->lsa.age, he->lsa.sn, he->lsa.checksum, he->oa ? he->oa->areaid : 0 ); he->lsa.checksum, he->oa ? he->oa->areaid : 0 );
switch (he->lsa.type) switch (he->lsa.type)
{ {
@ -925,7 +925,8 @@ ospf_dump_lsa(struct top_hash_entry *he, struct proto *p)
rr = (struct ospf_lsa_rt_link *) (rt + 1); rr = (struct ospf_lsa_rt_link *) (rt + 1);
for (i = 0; i < rt->links; i++) for (i = 0; i < rt->links; i++)
OSPF_TRACE(D_EVENTS, " - %1x %-1I %-1I %5u", rr[i].type, ipa_from_u32(rr[i].id), ipa_from_u32(rr[i].data), rr[i].metric); OSPF_TRACE(D_EVENTS, " - %1x %-1R %-1R %5u",
rr[i].type, rr[i].id, rr[i].data, rr[i].metric);
break; break;
case LSA_T_NET: case LSA_T_NET:
@ -935,7 +936,7 @@ ospf_dump_lsa(struct top_hash_entry *he, struct proto *p)
sizeof(struct ospf_lsa_net)) / sizeof(u32); sizeof(struct ospf_lsa_net)) / sizeof(u32);
for (i = 0; i < max; i++) for (i = 0; i < max; i++)
OSPF_TRACE(D_EVENTS, " - %-1I", ipa_from_u32(rts[i])); OSPF_TRACE(D_EVENTS, " - %-1R", rts[i]);
break; break;
default: default: