get_status() implemented.
This commit is contained in:
parent
d5f029df48
commit
4414d9a57a
1 changed files with 23 additions and 1 deletions
|
@ -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
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue