rl = (struct router_lsa *) w;
length = ntohs (w->length);
for (i = 0;
i < ntohs (rl->links) && length >= sizeof (struct router_lsa);
i++, length -= 12)
{
switch (rl->link[i].type)
{
case LSA_LINK_TYPE_POINTOPOINT:
case LSA_LINK_TYPE_VIRTUALLINK:
/* Router LSA ID. */
if (v->type == OSPF_ROUTER_LSA &&
IPV4_ADDR_SAME (&rl->link[i].link_id, &v->id))
{
return i;
}
break;
case LSA_LINK_TYPE_TRANSIT:
/* Network LSA ID. */
if (v->type == OSPF_NETWORK_LSA &&
IPV4_ADDR_SAME (&rl->link[i].link_id, &v->id))
{
return i;
}
break;
case LSA_LINK_TYPE_STUB:
/* Stub can't lead anywhere, carry on */
continue;
default:
break;
}
}