summaryrefslogtreecommitdiff
path: root/proto/ospf/neighbor.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2013-11-19 22:33:48 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2013-11-19 22:33:48 +0100
commit1ec522538fb81a56b068c087d0a842faf7aa7869 (patch)
tree84dc0555c224120da8772b1714e7e4f1dfa66aa5 /proto/ospf/neighbor.c
parent0e175f9f0fd872e95225355dbdeca49cd35ec0fd (diff)
BFD protocol, ready for release.
Supports OSPF and BGP and also statically configured sessions.
Diffstat (limited to 'proto/ospf/neighbor.c')
-rw-r--r--proto/ospf/neighbor.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/proto/ospf/neighbor.c b/proto/ospf/neighbor.c
index 26d81dce..61224ec2 100644
--- a/proto/ospf/neighbor.c
+++ b/proto/ospf/neighbor.c
@@ -582,6 +582,36 @@ ospf_neigh_remove(struct ospf_neighbor *n)
OSPF_TRACE(D_EVENTS, "Deleting neigbor.");
}
+static void
+ospf_neigh_bfd_hook(struct bfd_request *req)
+{
+ struct ospf_neighbor *n = req->data;
+ struct proto *p = &n->ifa->oa->po->proto;
+
+ if (req->down)
+ {
+ OSPF_TRACE(D_EVENTS, "BFD session down for %I on %s",
+ n->ip, n->ifa->iface->name);
+
+ ospf_neigh_remove(n);
+ }
+}
+
+void
+ospf_neigh_update_bfd(struct ospf_neighbor *n, int use_bfd)
+{
+ if (use_bfd && !n->bfd_req)
+ n->bfd_req = bfd_request_session(n->pool, n->ip, n->ifa->addr->ip, n->ifa->iface,
+ ospf_neigh_bfd_hook, n);
+
+ if (!use_bfd && n->bfd_req)
+ {
+ rfree(n->bfd_req);
+ n->bfd_req = NULL;
+ }
+}
+
+
void
ospf_sh_neigh_info(struct ospf_neighbor *n)
{