From 3aab39f589c352e30e9db92346b579dd561482b3 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Thu, 23 Jul 2009 16:51:28 +0200 Subject: Use %R in OSPF when appropriate. --- proto/ospf/rt.c | 49 +++++++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 26 deletions(-) (limited to 'proto/ospf/rt.c') diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index 123d4fb..a230d38 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -154,8 +154,7 @@ ospf_rt_spfa(struct ospf_area *oa) if (oa->rt == NULL) return; - OSPF_TRACE(D_EVENTS, "Starting routing table calculation for area %I", - ipa_from_u32(oa->areaid)); + OSPF_TRACE(D_EVENTS, "Starting routing table calculation for area %R", oa->areaid); if (oa->rt->dist != LSINFINITY) bug("Aging was not processed."); @@ -168,8 +167,8 @@ ospf_rt_spfa(struct ospf_area *oa) oa->rt->dist = 0; oa->rt->color = CANDIDATE; add_head(&oa->cand, &oa->rt->cn); - DBG("RT LSA: rt: %I, id: %I, type: %u\n", ipa_from_u32(oa->rt->lsa.rt), - ipa_from_u32(oa->rt->lsa.id), oa->rt->lsa.type); + DBG("RT LSA: rt: %R, id: %R, type: %u\n", + oa->rt->lsa.rt, oa->rt->lsa.id, oa->rt->lsa.type); 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); rem_node(n); - DBG("Working on LSA: rt: %I, id: %I, type: %u\n", ipa_from_u32(act->lsa.rt), - ipa_from_u32(act->lsa.id), act->lsa.type); + DBG("Working on LSA: rt: %R, id: %R, type: %u\n", + act->lsa.rt, act->lsa.id, act->lsa.type); act->color = INSPF; switch (act->lsa.type) @@ -208,7 +207,7 @@ ospf_rt_spfa(struct ospf_area *oa) { tmp = NULL; 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) { case LSART_STUB: @@ -265,7 +264,7 @@ ospf_rt_spfa(struct ospf_area *oa) DBG("PTP found.\n"); break; 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; } 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) - 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); if (tmp != NULL) 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))) { - 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); iface->iface = tmp->nhi->iface; iface->vip = tmp->lb; @@ -325,7 +324,7 @@ ospf_rt_spfa(struct ospf_area *oa) { 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); } } @@ -372,7 +371,7 @@ link_back(struct ospf_area *oa, struct top_hash_entry *fol, struct top_hash_entr } break; 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; } } @@ -390,7 +389,7 @@ link_back(struct ospf_area *oa, struct top_hash_entry *fol, struct top_hash_entr } break; default: - bug("Unknown lsa type. (id = %I)", ipa_from_u32(fol->lsa.id)); + bug("Unknown lsa type. (id = %R)", fol->lsa.id); } return 0; } @@ -480,7 +479,7 @@ ospf_rt_sum(struct ospf_area *oa) int mlen = -1, type = -1; 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) { @@ -663,9 +662,8 @@ ospf_ext_spf(struct proto_ospf *po) le = en->lsa_body; lt = (struct ospf_lsa_ext_tos *) (le + 1); - DBG("%s: Working on LSA. ID: %I, RT: %I, Type: %u, Mask %I\n", - p->name, ipa_from_u32(en->lsa.id), ipa_from_u32(en->lsa.rt), - en->lsa.type, le->netmask); + DBG("%s: Working on LSA. ID: %R, RT: %R, Type: %u, Mask %I\n", + p->name, en->lsa.id, en->lsa.rt, en->lsa.type, le->netmask); if ((lt->etm.metric & METRIC_MASK) == LSINFINITY) continue; @@ -673,9 +671,8 @@ ospf_ext_spf(struct proto_ospf *po) mlen = ipa_mklen(le->netmask); if ((mlen < 0) || (mlen > 32)) { - log("%s: Invalid mask in LSA. ID: %I, RT: %I, Type: %u, Mask %I", - p->name, ipa_from_u32(en->lsa.id), ipa_from_u32(en->lsa.rt), - en->lsa.type, le->netmask); + log("%s: Invalid mask in LSA. ID: %R, RT: %R, Type: %u, Mask %I", + p->name, en->lsa.id, en->lsa.rt, en->lsa.type, le->netmask); continue; } 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)) return; - DBG(" Adding candidate: rt: %I, id: %I, type: %u\n", - ipa_from_u32(en->lsa.rt), ipa_from_u32(en->lsa.id), en->lsa.type); + DBG(" Adding candidate: rt: %R, id: %R, type: %u\n", + en->lsa.rt, en->lsa.id, en->lsa.type); en->nhi = NULL; 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)) { neighbor *nn; - DBG(" Next hop calculating for id: %I rt: %I type: %u\n", - ipa_from_u32(en->lsa.id), ipa_from_u32(en->lsa.rt), en->lsa.type); + DBG(" Next hop calculating for id: %R rt: %R type: %u\n", + en->lsa.id, en->lsa.rt, en->lsa.type); if (par == oa->rt) { @@ -916,8 +913,8 @@ calc_next_hop(struct top_hash_entry *en, struct top_hash_entry *par, } else { /* Parent is some RT neighbor */ - log(L_ERR "Router's parent has no next hop. (EN=%I, PAR=%I)", - ipa_from_u32(en->lsa.id), ipa_from_u32(par->lsa.id)); + log(L_ERR "Router's parent has no next hop. (EN=%R, PAR=%R)", + en->lsa.id, par->lsa.id); /* I hope this would never happen */ return; } -- cgit v1.2.3