diff options
author | Ondrej Filip <feela@network.cz> | 2000-06-01 18:26:59 +0200 |
---|---|---|
committer | Ondrej Filip <feela@network.cz> | 2000-06-01 18:26:59 +0200 |
commit | 4ab4e9778f35f8a123ee6bbc2387b9870859b707 (patch) | |
tree | 23b767755892747887dcd4336f13818058975c51 | |
parent | cf318e3cd3206ad6a459a01e29e8494a100a67eb (diff) | |
download | bird-4ab4e9778f35f8a123ee6bbc2387b9870859b707.tar bird-4ab4e9778f35f8a123ee6bbc2387b9870859b707.zip |
show ospf implemented.
-rw-r--r-- | proto/ospf/config.Y | 3 | ||||
-rw-r--r-- | proto/ospf/neighbor.c | 4 | ||||
-rw-r--r-- | proto/ospf/ospf.c | 41 | ||||
-rw-r--r-- | proto/ospf/ospf.h | 1 |
4 files changed, 46 insertions, 3 deletions
diff --git a/proto/ospf/config.Y b/proto/ospf/config.Y index 9019759..0ee644c 100644 --- a/proto/ospf/config.Y +++ b/proto/ospf/config.Y @@ -40,6 +40,9 @@ CF_ADDTO(dynamic_attr, OSPF_METRIC1 { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF CF_ADDTO(dynamic_attr, OSPF_METRIC2 { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_OSPF_METRIC2); }) CF_ADDTO(dynamic_attr, OSPF_TAG { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_OSPF_TAG); }) +CF_CLI(SHOW OSPF, optsym, [<name>], [[Show information about ospf protocol]]) +{ ospf_sh(proto_get_named($3, &proto_ospf)); } ; + CF_CLI(SHOW OSPF NEIGHBORS, optsym, [<name>], [[Show information about ospf neighbors]]) { ospf_sh_neigh(proto_get_named($4, &proto_ospf)); } ; diff --git a/proto/ospf/neighbor.c b/proto/ospf/neighbor.c index 7faa8ae..3590504 100644 --- a/proto/ospf/neighbor.c +++ b/proto/ospf/neighbor.c @@ -500,11 +500,11 @@ ospf_sh_neigh_info(struct ospf_neighbor *n) min=(exp-sec)/60; if(min>59) { - sprintf(etime,"-Inf-"); + bsprintf(etime,"-Inf-"); } else { - sprintf(etime,"%02u:%02u", min, sec); + bsprintf(etime,"%02u:%02u", min, sec); } if(n->rid==ifa->drid) pos="dr "; diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index b8f7b98..7e7896a 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -324,7 +324,7 @@ ospf_sh_neigh(struct proto *p) struct ospf_neighbor *n; struct proto_ospf *po=(struct proto_ospf *)p; - cli_msg(-1013,"%s:",p->name); + cli_msg(-1013,"%s:", p->name); cli_msg(-1013,"%-12s\t%3s\t%-15s\t%-5s\t%-12s\t%-10s","Router ID","Pri", " State", "DTime", "Router IP", "Interface"); WALK_LIST(ifa,po->iface_list) @@ -332,3 +332,42 @@ ospf_sh_neigh(struct proto *p) ospf_sh_neigh_info(n); cli_msg(0,""); } + +void +ospf_sh(struct proto *p) +{ + struct ospf_area *oa; + struct proto_ospf *po=(struct proto_ospf *)p; + struct ospf_iface *ifa; + struct ospf_neighbor *n; + int ifano; + int nno; + int adjno; + + cli_msg(-1014,"%s:", p->name); + cli_msg(-1014,"Number of areas: %u", po->areano); + + WALK_LIST(oa,po->area_list) + { + cli_msg(-1014,"\tArea: %I (%u) %s", oa->areaid, oa->areaid, + oa->areaid==0 ? "[BACKBONE]" : ""); + ifano=0; + nno=0; + adjno=0; + WALK_LIST(ifa, po->iface_list) + { + if(oa==ifa->oa) ifano++; + WALK_LIST(n, ifa->neigh_list) + { + nno++; + if(n->state==NEIGHBOR_FULL) adjno++; + } + } + cli_msg(-1014,"\t\tNumber of interfaces: %u", ifano); + cli_msg(-1014,"\t\tNumber of LSAs: %u", oa->gr->hash_entries); + cli_msg(-1014,"\t\tNumber of neighbors: %u", nno); + cli_msg(-1014,"\t\tNumber of fully adjacent neighbors: %u", adjno); + } + cli_msg(0,""); +} + diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h index 0d7da5e..a952640 100644 --- a/proto/ospf/ospf.h +++ b/proto/ospf/ospf.h @@ -363,6 +363,7 @@ void area_disp(timer *timer); void schedule_rt_lsa(struct ospf_area *oa); void schedule_rtcalc(struct ospf_area *oa); void ospf_sh_neigh(struct proto *p); +void ospf_sh(struct proto *p); #define EA_OSPF_METRIC1 EA_CODE(EAP_OSPF, 0) #define EA_OSPF_METRIC2 EA_CODE(EAP_OSPF, 1) |