summaryrefslogtreecommitdiffstats
path: root/proto/ospf
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2009-07-05 19:01:54 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2009-07-05 19:01:54 +0200
commitf9bdcad4694cf80690982dfc58d28f91216c8bd0 (patch)
treea2bd8d812bf253bf3af87a6c9d58607baaa4ec50 /proto/ospf
parent2d785e8d6a646a878c970583aa54a15209fa0e6e (diff)
downloadbird-f9bdcad4694cf80690982dfc58d28f91216c8bd0.tar
bird-f9bdcad4694cf80690982dfc58d28f91216c8bd0.zip
Fixes type mismatch in OSPF printf statements.
Mixing ip_addr and u32 does bad things on Ultrasparc. Although both have the same size. Fascinating. It was not catched by compiler because of varargs.
Diffstat (limited to 'proto/ospf')
-rw-r--r--proto/ospf/iface.c13
-rw-r--r--proto/ospf/lsack.c8
-rw-r--r--proto/ospf/ospf.c22
3 files changed, 22 insertions, 21 deletions
diff --git a/proto/ospf/iface.c b/proto/ospf/iface.c
index 5162f9f..2239bef 100644
--- a/proto/ospf/iface.c
+++ b/proto/ospf/iface.c
@@ -113,7 +113,7 @@ ospf_iface_chstate(struct ospf_iface *ifa, u8 state)
{
OSPF_TRACE(D_EVENTS,
"Changing state of virtual link %I from \"%s\" into \"%s\".",
- ifa->vid, ospf_is[oldstate], ospf_is[state]);
+ ipa_from_u32(ifa->vid), ospf_is[oldstate], ospf_is[state]);
if (state == OSPF_IS_PTP)
{
ifa->ip_sk = ospf_open_ip_socket(ifa);
@@ -586,8 +586,8 @@ ospf_iface_info(struct ospf_iface *ifa)
strict = "";
if (ifa->type == OSPF_IT_VLINK)
{
- cli_msg(-1015, "Virtual link to %I:", ifa->vid);
- cli_msg(-1015, "\tTransit area: %I (%u)", ifa->voa->areaid,
+ cli_msg(-1015, "Virtual link to %I:", ipa_from_u32(ifa->vid));
+ cli_msg(-1015, "\tTransit area: %I (%u)", ipa_from_u32(ifa->voa->areaid),
ifa->voa->areaid);
}
else
@@ -595,13 +595,14 @@ ospf_iface_info(struct ospf_iface *ifa)
cli_msg(-1015, "Interface \"%s\":",
(ifa->iface ? ifa->iface->name : "(none)"));
cli_msg(-1015, "\tType: %s %s", ospf_it[ifa->type], strict);
- cli_msg(-1015, "\tArea: %I (%u)", ifa->oa->areaid, ifa->oa->areaid);
+ cli_msg(-1015, "\tArea: %I (%u)", ipa_from_u32(ifa->oa->areaid), ifa->oa->areaid);
}
cli_msg(-1015, "\tState: %s %s", ospf_is[ifa->state],
ifa->stub ? "(stub)" : "");
cli_msg(-1015, "\tPriority: %u", ifa->priority);
cli_msg(-1015, "\tCost: %u", ifa->cost);
cli_msg(-1015, "\tHello timer: %u", ifa->helloint);
+
if (ifa->type == OSPF_IT_NBMA)
{
cli_msg(-1015, "\tPoll timer: %u", ifa->pollint);
@@ -611,9 +612,9 @@ ospf_iface_info(struct ospf_iface *ifa)
cli_msg(-1015, "\tRetransmit timer: %u", ifa->rxmtint);
if ((ifa->type == OSPF_IT_BCAST) || (ifa->type == OSPF_IT_NBMA))
{
- cli_msg(-1015, "\tDesigned router (ID): %I", ifa->drid);
+ cli_msg(-1015, "\tDesigned router (ID): %I", ipa_from_u32(ifa->drid));
cli_msg(-1015, "\tDesigned router (IP): %I", ifa->drip);
- cli_msg(-1015, "\tBackup designed router (ID): %I", ifa->bdrid);
+ cli_msg(-1015, "\tBackup designed router (ID): %I", ipa_from_u32(ifa->bdrid));
cli_msg(-1015, "\tBackup designed router (IP): %I", ifa->bdrip);
}
}
diff --git a/proto/ospf/lsack.c b/proto/ospf/lsack.c
index 4652825..cc26666 100644
--- a/proto/ospf/lsack.c
+++ b/proto/ospf/lsack.c
@@ -43,7 +43,7 @@ ospf_lsack_enqueue(struct ospf_neighbor *n, struct ospf_lsa_header *h,
memcpy(&no->lsa, h, sizeof(struct ospf_lsa_header));
add_tail(&n->ackl[queue], NODE no);
DBG("Adding (%s) ack for %I, ID: %I, RT: %I, Type: %u\n", s_queue[queue],
- n->rid, ntohl(h->id), ntohl(h->rt), h->type);
+ ipa_from_u32(n->rid), ipa_from_u32(ntohl(h->id)), ipa_from_u32(ntohl(h->rt)), h->type);
}
void
@@ -77,8 +77,8 @@ ospf_lsack_send(struct ospf_neighbor *n, int queue)
no = (struct lsah_n *) HEAD(n->ackl[queue]);
memcpy(h + i, &no->lsa, sizeof(struct ospf_lsa_header));
i++;
- DBG("Iter %u ID: %I, RT: %I, Type: %u\n", i, ntohl((h + i)->id),
- ntohl((h + i)->rt), (h + i)->type);
+ DBG("Iter %u ID: %I, RT: %I, Type: %u\n", i, ipa_from_u32(ntohl((h + i)->id)),
+ ipa_from_u32(ntohl((h + i)->rt)), (h + i)->type);
rem_node(NODE no);
mb_free(no);
if ((i * sizeof(struct ospf_lsa_header) +
@@ -191,7 +191,7 @@ ospf_lsack_receive(struct ospf_lsack_packet *ps,
}
DBG("Deleting LS Id: %I RT: %I Type: %u from LS Retl for neighbor %I\n",
- lsa.id, lsa.rt, lsa.type, n->rid);
+ ipa_from_u32(lsa.id), ipa_from_u32(lsa.rt), lsa.type, ipa_from_u32(n->rid));
s_rem_node(SNODE en);
if (en->lsa_body != NULL)
mb_free(en->lsa_body);
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c
index c9b5f43..4a67128 100644
--- a/proto/ospf/ospf.c
+++ b/proto/ospf/ospf.c
@@ -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, "state: %u", ifa->state);
- OSPF_TRACE(D_EVENTS, "DR: %I", ifa->drid);
- OSPF_TRACE(D_EVENTS, "BDR: %I", ifa->bdrid);
+ OSPF_TRACE(D_EVENTS, "DR: %I", ipa_from_u32(ifa->drid));
+ OSPF_TRACE(D_EVENTS, "BDR: %I", ipa_from_u32(ifa->bdrid));
WALK_LIST(n, ifa->neigh_list)
{
- OSPF_TRACE(D_EVENTS, " neighbor %I in state %u", n->rid, n->state);
+ OSPF_TRACE(D_EVENTS, " neighbor %I in state %u", ipa_from_u32(n->rid), n->state);
}
}
@@ -310,7 +310,7 @@ schedule_rt_lsa(struct ospf_area *oa)
struct proto *p = &oa->po->proto;
OSPF_TRACE(D_EVENTS, "Scheduling RT lsa origination for area %I.",
- oa->areaid);
+ ipa_from_u32(oa->areaid));
oa->origrt = 1;
}
@@ -953,7 +953,7 @@ ospf_sh(struct proto *p)
WALK_LIST(oa, po->area_list)
{
- cli_msg(-1014, "\tArea: %I (%u) %s", oa->areaid, oa->areaid,
+ cli_msg(-1014, "\tArea: %I (%u) %s", ipa_from_u32(oa->areaid), oa->areaid,
oa->areaid == 0 ? "[BACKBONE]" : "");
ifano = 0;
nno = 0;
@@ -1088,7 +1088,7 @@ show_lsa_router(struct top_hash_entry *he)
for (i = 0; i < rt->links; i++)
if (rr[i].type == LSART_PTP)
- cli_msg(-1016, "\t\trouter %I metric %u ", rr[i].id, rr[i].metric);
+ cli_msg(-1016, "\t\trouter %I metric %u ", ipa_from_u32(rr[i].id), rr[i].metric);
for (i = 0; i < rt->links; i++)
if (rr[i].type == LSART_NET)
@@ -1125,10 +1125,10 @@ show_lsa_network(struct top_hash_entry *he)
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, "\t\tdr %I", lsa->rt);
+ cli_msg(-1016, "\t\tdr %I", ipa_from_u32(lsa->rt));
for (i = 0; i < max; i++)
- cli_msg(-1016, "\t\trouter %I", rts[i]);
+ cli_msg(-1016, "\t\trouter %I", ipa_from_u32(rts[i]));
}
static inline void
@@ -1143,7 +1143,7 @@ show_lsa_sum_net(struct top_hash_entry *he)
static inline void
show_lsa_sum_rt(struct top_hash_entry *he)
{
- cli_msg(-1016, "\t\txrouter %I", he->lsa.id);
+ cli_msg(-1016, "\t\txrouter %I", ipa_from_u32(he->lsa.id));
}
@@ -1207,7 +1207,7 @@ ospf_sh_state(struct proto *p, int verbose)
if (last_area != hea[i]->oa->areaid)
{
cli_msg(-1016, "");
- cli_msg(-1016, "area %I", hea[i]->oa->areaid);
+ cli_msg(-1016, "area %I", ipa_from_u32(hea[i]->oa->areaid));
last_area = hea[i]->oa->areaid;
last_rt = 0xFFFFFFFF;
}
@@ -1215,7 +1215,7 @@ ospf_sh_state(struct proto *p, int verbose)
if ((hea[i]->lsa.rt != last_rt) && (hea[i]->lsa.type != LSA_T_NET))
{
cli_msg(-1016, "");
- cli_msg(-1016, (hea[i]->lsa.type != LSA_T_EXT) ? "\trouter %I" : "\txrouter %I", hea[i]->lsa.rt);
+ cli_msg(-1016, (hea[i]->lsa.type != LSA_T_EXT) ? "\trouter %I" : "\txrouter %I", ipa_from_u32(hea[i]->lsa.rt));
last_rt = hea[i]->lsa.rt;
}