summaryrefslogtreecommitdiff
path: root/proto/ospf/ospf.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2012-03-16 12:12:26 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2012-03-16 12:12:26 +0100
commit20ab192beca749166e19118e987b53b5e131d0cf (patch)
tree869cc9208ddb8a02140057d30813f7532d56d35a /proto/ospf/ospf.c
parent0888a737b045b48106edbd28ba3cd62fcc8c191e (diff)
Adds filtering to 'show ospf lsadb' command.
Thanks Alexander V. Chernikov for the original patch.
Diffstat (limited to 'proto/ospf/ospf.c')
-rw-r--r--proto/ospf/ospf.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c
index 73c06c27..9872faf2 100644
--- a/proto/ospf/ospf.c
+++ b/proto/ospf/ospf.c
@@ -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))
{