1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Adds filtering to 'show ospf lsadb' command.

Thanks Alexander V. Chernikov for the original patch.
This commit is contained in:
Ondrej Zajicek
2012-03-16 12:12:26 +01:00
parent 0888a737b0
commit 20ab192bec
5 changed files with 56 additions and 4 deletions

View File

@@ -1471,8 +1471,9 @@ lsa_compare_for_lsadb(const void *p1, const void *p2)
}
void
ospf_sh_lsadb(struct proto *p)
ospf_sh_lsadb(struct lsadb_show_data *ld)
{
struct proto *p = proto_get_named(ld->name, &proto_ospf);
struct proto_ospf *po = (struct proto_ospf *) p;
int num = po->gr->hash_entries;
unsigned int i, j;
@@ -1486,6 +1487,9 @@ ospf_sh_lsadb(struct proto *p)
return;
}
if (ld->router == SH_ROUTER_SELF)
ld->router = po->router_id;
struct top_hash_entry *hea[num];
struct top_hash_entry *he;
@@ -1502,6 +1506,22 @@ ospf_sh_lsadb(struct proto *p)
{
struct ospf_lsa_header *lsa = &(hea[i]->lsa);
int dscope = LSA_SCOPE(lsa);
if (ld->scope && (dscope != (ld->scope & 0xf000)))
continue;
if ((ld->scope == LSA_SCOPE_AREA) && (hea[i]->domain != ld->area))
continue;
/* Ignore high nibble */
if (ld->type && ((lsa->type & 0x0fff) != (ld->type & 0x0fff)))
continue;
if (ld->lsid && (lsa->id != ld->lsid))
continue;
if (ld->router && (lsa->rt != ld->router))
continue;
if ((dscope != last_dscope) || (hea[i]->domain != last_domain))
{