summaryrefslogtreecommitdiff
path: root/nest
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-02-02 11:20:53 +0100
committerMaria Matejka <mq@ucw.cz>2022-02-03 10:30:33 +0100
commitd262695d4e8ddee7b9408bb726b4100f68d217d7 (patch)
tree9ff1286e67892bbbf3abf75eeebacb2f0afc538f /nest
parent09380db594e1befb991be626b36783cae525d823 (diff)
BFD: direct notifications to protocol loops
Diffstat (limited to 'nest')
-rw-r--r--nest/bfd.h12
-rw-r--r--nest/proto.c10
2 files changed, 16 insertions, 6 deletions
diff --git a/nest/bfd.h b/nest/bfd.h
index 37561266..c91d6648 100644
--- a/nest/bfd.h
+++ b/nest/bfd.h
@@ -23,6 +23,11 @@ struct bfd_options {
u8 mode;
};
+struct bfd_session_state {
+ u8 state;
+ u8 diag;
+};
+
struct bfd_request {
resource r;
node n;
@@ -35,12 +40,12 @@ struct bfd_request {
void (*hook)(struct bfd_request *);
void *data;
+ event event;
struct bfd_session *session;
-
+ struct bfd_session_state old_state;
u8 state;
u8 diag;
- u8 old_state;
u8 down;
};
@@ -51,13 +56,12 @@ struct bfd_request {
#define BFD_STATE_INIT 2
#define BFD_STATE_UP 3
-
static inline struct bfd_options * bfd_new_options(void)
{ return cfg_allocz(sizeof(struct bfd_options)); }
#ifdef CONFIG_BFD
-struct bfd_request * bfd_request_session(pool *p, ip_addr addr, ip_addr local, struct iface *iface, struct iface *vrf, void (*hook)(struct bfd_request *), void *data, const struct bfd_options *opts);
+struct bfd_request * bfd_request_session(pool *p, ip_addr addr, ip_addr local, struct iface *iface, struct iface *vrf, void (*hook)(struct bfd_request *), void *data, struct event_list *list, const struct bfd_options *opts);
void bfd_update_request(struct bfd_request *req, const struct bfd_options *opts);
static inline void cf_check_bfd(int use UNUSED) { }
diff --git a/nest/proto.c b/nest/proto.c
index 3ba8ac5c..c350d1cb 100644
--- a/nest/proto.c
+++ b/nest/proto.c
@@ -1762,8 +1762,14 @@ protos_commit(struct config *new, struct config *old, int force_reconfig, int ty
nc->proto = p;
/* We will try to reconfigure protocol p */
- if (! force_reconfig && proto_reconfigure(p, oc, nc, type))
- continue;
+ if (!force_reconfig)
+ {
+ int ok;
+ PROTO_LOCKED_FROM_MAIN(p)
+ ok = proto_reconfigure(p, oc, nc, type);
+ if (ok)
+ continue;
+ }
if (nc->parent)
{