From a783e259d8d710208280126177487cc790418515 Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Thu, 1 Jun 2000 15:53:06 +0000 Subject: Cisco-like "show ospf neighbors" implemented. --- proto/ospf/neighbor.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'proto/ospf/neighbor.c') diff --git a/proto/ospf/neighbor.c b/proto/ospf/neighbor.c index c4f457a..7faa8ae 100644 --- a/proto/ospf/neighbor.c +++ b/proto/ospf/neighbor.c @@ -8,8 +8,14 @@ #include "ospf.h" -char *ospf_ns[]={"down", "attempt", "init", "2way", "exstart", "exchange", - "loading", "full"}; +char *ospf_ns[]={" down", + " attempt", + " init", + " 2way", + " exstart", + "exchange", + " loading", + " full"}; const char *ospf_inm[]={ "hello received", "neighbor start", "2-way received", "negotiation done", "exstart done", "bad ls request", "load done", @@ -480,3 +486,31 @@ ospf_neigh_remove(struct ospf_neighbor *n) mb_free(n); debug("%s: Deleting neigbor.\n", p->name); } + +void +ospf_sh_neigh_info(struct ospf_neighbor *n) +{ + struct ospf_iface *ifa=n->ifa; + char *pos="other"; + char etime[6]; + int exp,sec,min; + + exp=n->inactim->expires-now; + sec=exp-(exp/60); + min=(exp-sec)/60; + if(min>59) + { + sprintf(etime,"-Inf-"); + } + else + { + sprintf(etime,"%02u:%02u", min, sec); + } + + if(n->rid==ifa->drid) pos="dr "; + if(n->rid==ifa->bdrid) pos="bdr "; + + + cli_msg(-1013,"%-18I\t%3u\t%s/%s\t%-5s\t%-18I\t%-10s",n->rid, n->priority, + ospf_ns[n->state], pos, etime, n->ip,ifa->iface->name); +} -- cgit v1.2.3