mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-12 11:18:59 +00:00
Merge pull request #6460 from rgirada/ospf_external_lsa
ospfd: External LSA lookup in LSDB failed in a specific scenario
This commit is contained in:
commit
b71ca5ae42
@ -213,25 +213,35 @@ struct ospf_lsa *ospf_external_info_find_lsa(struct ospf *ospf,
|
|||||||
struct as_external_lsa *al;
|
struct as_external_lsa *al;
|
||||||
struct in_addr mask, id;
|
struct in_addr mask, id;
|
||||||
|
|
||||||
|
/* Fisrt search the lsdb with address specifc LSID
|
||||||
|
* where all the host bits are set, if there a matched
|
||||||
|
* LSA, return.
|
||||||
|
* Ex: For route 10.0.0.0/16, LSID is 10.0.255.255
|
||||||
|
* If no lsa with above LSID, use received address as
|
||||||
|
* LSID and check if any LSA in LSDB.
|
||||||
|
* If LSA found, check if the mask is same b/w the matched
|
||||||
|
* LSA and received prefix, if same then it is the LSA for
|
||||||
|
* this prefix.
|
||||||
|
* Ex: For route 10.0.0.0/16, LSID is 10.0.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
masklen2ip(p->prefixlen, &mask);
|
||||||
|
id.s_addr = p->prefix.s_addr | (~mask.s_addr);
|
||||||
|
lsa = ospf_lsdb_lookup_by_id(ospf->lsdb, OSPF_AS_EXTERNAL_LSA, id,
|
||||||
|
ospf->router_id);
|
||||||
|
if (lsa)
|
||||||
|
return lsa;
|
||||||
|
|
||||||
lsa = ospf_lsdb_lookup_by_id(ospf->lsdb, OSPF_AS_EXTERNAL_LSA,
|
lsa = ospf_lsdb_lookup_by_id(ospf->lsdb, OSPF_AS_EXTERNAL_LSA,
|
||||||
p->prefix, ospf->router_id);
|
p->prefix, ospf->router_id);
|
||||||
|
|
||||||
if (!lsa)
|
if (lsa) {
|
||||||
return NULL;
|
|
||||||
|
|
||||||
al = (struct as_external_lsa *)lsa->data;
|
al = (struct as_external_lsa *)lsa->data;
|
||||||
|
if (mask.s_addr == al->mask.s_addr)
|
||||||
masklen2ip(p->prefixlen, &mask);
|
return lsa;
|
||||||
|
|
||||||
if (mask.s_addr != al->mask.s_addr) {
|
|
||||||
id.s_addr = p->prefix.s_addr | (~mask.s_addr);
|
|
||||||
lsa = ospf_lsdb_lookup_by_id(ospf->lsdb, OSPF_AS_EXTERNAL_LSA,
|
|
||||||
id, ospf->router_id);
|
|
||||||
if (!lsa)
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return lsa;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user