diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2020-11-08 15:33:22 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2020-11-08 15:33:22 +0100 |
commit | 9d3fc3062b236f51b2c72a4c2c7b068f1946261d (patch) | |
tree | 0a24e42caff1ba4eb004fc1831b1c0b00407216f /nest/bfd.h | |
parent | fc1e3211b109400c0e96f889829c9f5145ac7226 (diff) |
BFD: Allow per-request session options
BFD session options are configured per interface in BFD protocol. This
patch allows to specify them also per-request in protocols requesting
sessions (currently limited to BGP).
Diffstat (limited to 'nest/bfd.h')
-rw-r--r-- | nest/bfd.h | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -9,9 +9,20 @@ #include "lib/lists.h" #include "lib/resource.h" +#include "conf/conf.h" struct bfd_session; +struct bfd_options { + u32 min_rx_int; + u32 min_tx_int; + u32 idle_tx_int; + u8 multiplier; + u8 passive; + u8 passive_set; + u8 mode; +}; + struct bfd_request { resource r; node n; @@ -20,6 +31,7 @@ struct bfd_request { ip_addr local; struct iface *iface; struct iface *vrf; + struct bfd_options opts; void (*hook)(struct bfd_request *); void *data; @@ -32,6 +44,7 @@ struct bfd_request { u8 down; }; +#define BGP_BFD_GRACEFUL 2 /* BFD down triggers graceful restart */ #define BFD_STATE_ADMIN_DOWN 0 #define BFD_STATE_DOWN 1 @@ -39,15 +52,20 @@ struct bfd_request { #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); +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); +void bfd_update_request(struct bfd_request *req, const struct bfd_options *opts); static inline void cf_check_bfd(int use UNUSED) { } #else -static inline struct bfd_request * bfd_request_session(pool *p UNUSED, ip_addr addr UNUSED, ip_addr local UNUSED, struct iface *iface UNUSED, struct iface *vrf UNUSED, void (*hook)(struct bfd_request *) UNUSED, void *data UNUSED) { return NULL; } +static inline struct bfd_request * bfd_request_session(pool *p UNUSED, ip_addr addr UNUSED, ip_addr local UNUSED, struct iface *iface UNUSED, struct iface *vrf UNUSED, void (*hook)(struct bfd_request *) UNUSED, void *data UNUSED, const struct bfd_options *opts UNUSED) { return NULL; } +static inline void bfd_update_request(struct bfd_request *req UNUSED, const struct bfd_options *opts UNUSED) { }; static inline void cf_check_bfd(int use) { if (use) cf_error("BFD not available"); } |