summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>2000-05-28 18:49:33 +0000
committerOndrej Filip <feela@network.cz>2000-05-28 18:49:33 +0000
commit4414d9a57a0dae3da0e0e0d924bf8cab89070716 (patch)
tree398da41bbb4417d19aa58296d9fd1a511d50d3df /proto
parentd5f029df482e596ccdbac341f605f6f809229db1 (diff)
get_status() implemented.
Diffstat (limited to 'proto')
-rw-r--r--proto/ospf/ospf.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c
index 893ee58f..dd7ffab0 100644
--- a/proto/ospf/ospf.c
+++ b/proto/ospf/ospf.c
@@ -176,11 +176,33 @@ ospf_rt_notify(struct proto *p, net *n, rte *new, rte *old, ea_list *attrs)
}
}
+static void
+ospf_get_status(struct proto *p, byte *buf)
+{
+ struct proto_ospf *po=(struct proto_ospf *)p;
+
+ if (p->proto_state == PS_DOWN) buf[0] = 0;
+ else
+ {
+ struct ospf_iface *ifa;
+ struct ospf_neighbor *n;
+ int adj=0;
+
+ WALK_LIST(ifa,po->iface_list)
+ WALK_LIST(n,ifa->neigh_list)
+ if(n->state==NEIGHBOR_FULL) adj=1;
+
+ if(adj==0) strcpy(buf, "Alone");
+ else strcpy(buf, "Running");
+ }
+}
+
struct protocol proto_ospf = {
name: "OSPF",
template: "ospf%d",
init: ospf_init,
dump: ospf_dump,
start: ospf_start,
- shutdown: ospf_shutdown
+ shutdown: ospf_shutdown,
+ get_status: ospf_get_status
};