summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
};