diff options
author | Ondrej Filip <feela@network.cz> | 2000-06-01 17:53:06 +0200 |
---|---|---|
committer | Ondrej Filip <feela@network.cz> | 2000-06-01 17:53:06 +0200 |
commit | a783e259d8d710208280126177487cc790418515 (patch) | |
tree | 961bb067c8e7e9c608b839f7abc1128eedec89a3 /proto/ospf/neighbor.c | |
parent | b594ad238692738352cd8827d71038a356b0d5a5 (diff) | |
download | bird-a783e259d8d710208280126177487cc790418515.tar bird-a783e259d8d710208280126177487cc790418515.zip |
Cisco-like "show ospf neighbors" implemented.
Diffstat (limited to 'proto/ospf/neighbor.c')
-rw-r--r-- | proto/ospf/neighbor.c | 38 |
1 files changed, 36 insertions, 2 deletions
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); +} |