]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
show ospf implemented.
authorOndrej Filip <feela@network.cz>
Thu, 1 Jun 2000 16:26:59 +0000 (16:26 +0000)
committerOndrej Filip <feela@network.cz>
Thu, 1 Jun 2000 16:26:59 +0000 (16:26 +0000)
proto/ospf/config.Y
proto/ospf/neighbor.c
proto/ospf/ospf.c
proto/ospf/ospf.h

index 901975979599a257ff2e464b4a90adf88ec38129..0ee644c6027a1acbb421541ff48f04927015bbea 100644 (file)
@@ -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)); } ;
 
index 7faa8ae9001f94d5d7d932607e68be5b18c27299..359050485021937511fbbcb7a6643113ef1a617e 100644 (file)
@@ -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   ";
index b8f7b9841ea5dac7ba3c1d35806a85e55cbb9f75..7e7896a1c61d551951f15814a27ffbd503fef021 100644 (file)
@@ -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,"");
+}
+
index 0d7da5ed601f9873d135ad1b186f1e741a693174..a952640f51e6b38ad93c3d46e879f90bae56bbc3 100644 (file)
@@ -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)