0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

Bugfix - count courrectly next hop on single hop virtual link.

This commit is contained in:
Ondrej Filip 2005-02-20 03:37:47 +00:00
parent 6eb4b73fe8
commit 7de7470a2a

View File

@ -117,11 +117,11 @@ ri_install(struct proto_ospf *po, ip_addr prefix, int pxlen, int dest,
{ {
memcpy(&old->n, new, sizeof(orta)); memcpy(&old->n, new, sizeof(orta));
old->efn = ipath; old->efn = ipath;
} if ((new->type == RTS_OSPF) && (anet = (struct area_net *)fib_route(&oa->net_fib, prefix, pxlen)))
if ((new->type == RTS_OSPF) && (anet = (struct area_net *)fib_route(&oa->net_fib, prefix, pxlen))) {
{ anet->active = 1;
anet->active = 1; if (new->metric1 > anet->metric) anet->metric = new->metric1;
if (new->metric1 > anet->metric) anet->metric = new->metric1; }
} }
} }
else else
@ -890,8 +890,8 @@ calc_next_hop(struct top_hash_entry *en, struct top_hash_entry *par,
if ((neigh = find_neigh_noifa(po, en->lsa.rt)) == NULL) if ((neigh = find_neigh_noifa(po, en->lsa.rt)) == NULL)
return; return;
en->nhi = neigh->ifa; en->nhi = neigh->ifa;
if (neigh->ifa->type == OSPF_IT_VLINK) if (ipa_equal(en->nh, IPA_NONE))
en->nh = neigh->ip; /* Yes, neighbor is it's en->nh = neigh->ip; /* Yes, neighbor is it's
* own next hop */ * own next hop */
return; return;
} }
@ -913,7 +913,7 @@ calc_next_hop(struct top_hash_entry *en, struct top_hash_entry *par,
{ /* 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=%I, PAR=%I)",
en->lsa.id, par->lsa.id); en->lsa.id, par->lsa.id);
/* I hoped this would never happen */ /* I hope this would never happen */
return; return;
} }
} }
@ -961,20 +961,18 @@ again1:
if (nf->n.ifa) a0.iface = nf->n.ifa->iface; if (nf->n.ifa) a0.iface = nf->n.ifa->iface;
a0.gw = nf->n.nh; a0.gw = nf->n.nh;
if (ipa_equal(nf->n.nh, IPA_NONE)) a0.dest = RTD_DEVICE;
if ((!ipa_equal(nf->n.nh, IPA_NONE)) && (!neigh_find(p, &nf->n.nh, 0))) if ((!ipa_equal(nf->n.nh, IPA_NONE)) && (!neigh_find(p, &nf->n.nh, 0)))
{ {
int found = 0; int found = 0;
struct ospf_iface *ifa; struct ospf_iface *ifa;
struct top_hash_entry *en; struct top_hash_entry *en;
DBG("Trying to find correct next hop"); OSPF_TRACE(D_EVENTS, "Trying to find correct next hop");
WALK_LIST(ifa, po->iface_list) WALK_LIST(ifa, po->iface_list)
{ {
if ((ifa->type == OSPF_IT_VLINK) && ipa_equal(ifa->vip, nf->n.nh)) if ((ifa->type == OSPF_IT_VLINK) && ipa_equal(ifa->vip, nf->n.nh))
{ {
if ((en = ospf_hash_find(po->gr, ifa->voa->areaid, ifa->vid, ifa->vid, LSA_T_RT)) && if ((en = ospf_hash_find(po->gr, ifa->voa->areaid, ifa->vid, ifa->vid, LSA_T_RT))
(!ipa_equal(en->nh, IPA_NONE))) && (!ipa_equal(en->nh, IPA_NONE)))
{ {
a0.gw = en->nh; a0.gw = en->nh;
found = 1; found = 1;
@ -985,6 +983,8 @@ again1:
if (!found) nf->n.metric1 = LSINFINITY; /* Delete it */ if (!found) nf->n.metric1 = LSINFINITY; /* Delete it */
} }
if (ipa_equal(nf->n.nh, IPA_NONE)) a0.dest = RTD_DEVICE;
if (!a0.iface) /* Still no match? Can this really happen? */ if (!a0.iface) /* Still no match? Can this really happen? */
nf->n.metric1 = LSINFINITY; nf->n.metric1 = LSINFINITY;