]> git.ipfire.org Git - thirdparty/bird.git/blame - nest/bfd.h
Kernel: Do not use route replace when krt_metric differs
[thirdparty/bird.git] / nest / bfd.h
CommitLineData
7c9930f9
OZ
1/*
2 * BIRD -- Bidirectional Forwarding Detection (BFD)
3 *
4 * Can be freely distributed and used under the terms of the GNU GPL.
5 */
6
7#ifndef _BIRD_NBFD_H_
8#define _BIRD_NBFD_H_
9
10#include "lib/lists.h"
11#include "lib/resource.h"
9d3fc306 12#include "conf/conf.h"
7c9930f9
OZ
13
14struct bfd_session;
15
9d3fc306
OZ
16struct bfd_options {
17 u32 min_rx_int;
18 u32 min_tx_int;
19 u32 idle_tx_int;
20 u8 multiplier;
21 u8 passive;
22 u8 passive_set;
23 u8 mode;
e6dbde68
KK
24 u8 auth_type; /* Authentication type (BFD_AUTH_*) */
25 list *passwords; /* Passwords for authentication */
9d3fc306
OZ
26};
27
7c9930f9
OZ
28struct bfd_request {
29 resource r;
30 node n;
31
32 ip_addr addr;
33 ip_addr local;
34 struct iface *iface;
cf7ff995 35 struct iface *vrf;
9d3fc306 36 struct bfd_options opts;
7c9930f9
OZ
37
38 void (*hook)(struct bfd_request *);
39 void *data;
40
41 struct bfd_session *session;
42
43 u8 state;
44 u8 diag;
45 u8 old_state;
46 u8 down;
47};
48
9d3fc306 49#define BGP_BFD_GRACEFUL 2 /* BFD down triggers graceful restart */
7c9930f9 50
538264cf
OZ
51#define BFD_STATE_ADMIN_DOWN 0
52#define BFD_STATE_DOWN 1
53#define BFD_STATE_INIT 2
54#define BFD_STATE_UP 3
55
56
9d3fc306
OZ
57static inline struct bfd_options * bfd_new_options(void)
58{ return cfg_allocz(sizeof(struct bfd_options)); }
59
7c9930f9
OZ
60#ifdef CONFIG_BFD
61
9d3fc306
OZ
62struct 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);
63void bfd_update_request(struct bfd_request *req, const struct bfd_options *opts);
7c9930f9 64
3e236955 65static inline void cf_check_bfd(int use UNUSED) { }
7c9930f9
OZ
66
67#else
68
9d3fc306
OZ
69static 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; }
70static inline void bfd_update_request(struct bfd_request *req UNUSED, const struct bfd_options *opts UNUSED) { };
7c9930f9
OZ
71
72static inline void cf_check_bfd(int use) { if (use) cf_error("BFD not available"); }
73
74#endif /* CONFIG_BFD */
75
76
77
78#endif /* _BIRD_NBFD_H_ */