log(L_WARN "%s: Cannot use interface %s as %s, forcing %s",
p->name, iface->name, ospf_it[old_type], ospf_it[ifa->type]);
+ /* Assign iface ID, for vlinks, this is ugly hack */
+ ifa->iface_id = (ifa->type != OSPF_IT_VLINK) ? iface->index : oa->po->last_vlink_id++;
init_list(&ifa->neigh_list);
init_list(&ifa->nbma_list);
u32 rxmtint; /* number of seconds between LSA retransmissions */
u32 pollint; /* Poll interval */
u32 deadint; /* after "deadint" missing hellos is router dead */
- u32 vid; /* Id of peer of virtual link */
+ u32 iface_id; /* Interface ID (iface->index or new value for vlinks) */
+ u32 vid; /* ID of peer of virtual link */
ip_addr vip; /* IP of peer of virtual link */
struct ospf_iface *vifa; /* OSPF iface which the vlink goes through */
struct ospf_area *voa; /* OSPF area which the vlink goes through */
int lsab_size, lsab_used;
linpool *nhpool; /* Linpool used for next hops computed in SPF */
u32 router_id;
+ u32 last_vlink_id; /* Interface IDs for vlinks (starts at 0x80000000) */
};
struct ospf_iface_patt
ln->type = LSART_PTP;
ln->id = neigh->rid;
ln->data = (ifa->addr->flags & IA_PEER) ?
- ifa->iface->index : ipa_to_u32(ifa->addr->ip);
+ ifa->iface_id : ipa_to_u32(ifa->addr->ip);
ln->metric = ifa->cost;
ln->padding = 0;
i++;
ln->type = type;
ln->padding = 0;
ln->metric = ifa->cost;
- ln->lif = ifa->iface->index;
+ ln->lif = ifa->iface_id;
ln->nif = nif;
ln->id = id;
}
if (n->state == NEIGHBOR_FULL)
{
#ifdef OSPFv3
- en = ospf_hash_find(po->gr, ifa->iface->index, n->iface_id, n->rid, LSA_T_LINK);
+ en = ospf_hash_find(po->gr, ifa->iface_id, n->iface_id, n->rid, LSA_T_LINK);
if (en)
options |= ((struct ospf_lsa_link *) en->lsa_body)->options;
#endif
lsa.options = ifa->oa->options;
lsa.id = ipa_to_u32(ifa->addr->ip);
#else /* OSPFv3 */
- lsa.id = ifa->iface->index;
+ lsa.id = ifa->iface_id;
#endif
lsa.rt = po->router_id;
lsa.age = 0;
lsa.type = LSA_T_LINK;
- lsa.id = ifa->iface->index;
+ lsa.id = ifa->iface_id;
lsa.rt = po->router_id;
lsa.sn = get_seqnum(ifa->link_lsa);
- u32 dom = ifa->iface->index;
+ u32 dom = ifa->iface_id;
body = originate_link_lsa_body(ifa, &lsa.length);
lsasum_calculate(&lsa, body);
WALK_LIST(n, ifa->neigh_list)
if ((n->state == NEIGHBOR_FULL) &&
- (en = ospf_hash_find(po->gr, ifa->iface->index, n->iface_id, n->rid, LSA_T_LINK)))
+ (en = ospf_hash_find(po->gr, ifa->iface_id, n->iface_id, n->rid, LSA_T_LINK)))
add_link_lsa(po, en, offset, &pxc);
lp = po->lsab;
lsa.age = 0;
lsa.type = LSA_T_PREFIX;
- lsa.id = ifa->iface->index;
+ lsa.id = ifa->iface_id;
lsa.rt = po->router_id;
lsa.sn = get_seqnum(ifa->pxn_lsa);
u32 dom = ifa->oa->areaid;
switch (type & LSA_SCOPE_MASK)
{
case LSA_SCOPE_LINK:
- return ifa->iface->index;
+ return ifa->iface_id;
case LSA_SCOPE_AREA:
return ifa->oa->areaid;