summaryrefslogtreecommitdiff
path: root/proto/ospf/neighbor.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2013-11-22 02:43:41 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2013-11-22 02:48:44 +0100
commit0aeac9cb7f9887374ce0258c8653f9518529bf08 (patch)
tree2d16e0904be1658c08a4c779cf4132bc8bf20efa /proto/ospf/neighbor.c
parent8931425d02dd8656b48142f608d3119ab6f4a96f (diff)
parent7c9930f9c8feb3b08f7a9e94a08807ccbbc096f5 (diff)
Merge commit 'origin/bfd'
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)
{