diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-06-04 18:56:05 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-07-17 13:16:18 +0200 |
commit | 68197386ddba616c9973d3190c42f6121a25d9b7 (patch) | |
tree | f328462a31a041a8c87f11c76e06503a515943c5 /proto/bgp/bgp.h | |
parent | 470efcb98cb33de2d5636679eb0f72c88280d6b8 (diff) |
BGP: Long-lived graceful restart
The patch implements long-lived graceful restart for BGP, namely
draft-uttaro-idr-bgp-persistence-03.
Diffstat (limited to 'proto/bgp/bgp.h')
-rw-r--r-- | proto/bgp/bgp.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h index b3db8b7e..53194fb6 100644 --- a/proto/bgp/bgp.h +++ b/proto/bgp/bgp.h @@ -52,8 +52,10 @@ struct bgp_config { int allow_local_as; /* Allow that number of local ASNs in incoming AS_PATHs */ int allow_local_pref; /* Allow LOCAL_PREF in EBGP sessions */ int gr_mode; /* Graceful restart mode (BGP_GR_*) */ + int llgr_mode; /* Long-lived graceful restart mode (BGP_LLGR_*) */ int setkey; /* Set MD5 password to system SA/SP database */ unsigned gr_time; /* Graceful restart timeout */ + unsigned llgr_time; /* Long-lived graceful restart timeout */ unsigned connect_delay_time; /* Minimum delay between connect attempts */ unsigned connect_retry_time; /* Timeout for connect attempts */ unsigned hold_time, initial_hold_time; @@ -90,6 +92,16 @@ struct bgp_config { /* For peer_gr_aflags */ #define BGP_GRF_FORWARDING 0x80 +#define BGP_LLGR_ABLE 1 +#define BGP_LLGR_AWARE 2 + +#define BGP_LLGRF_FORWARDING 0x80 + +#define BGP_GRS_NONE 0 /* No GR */ +#define BGP_GRS_ACTIVE 1 /* Graceful restart per RFC 4724 */ +#define BGP_GRS_LLGR_1 2 /* Long-lived GR phase 1 (restart time) */ +#define BGP_GRS_LLGR_2 3 /* Long-lived GR phase 2 (stale time) */ + struct bgp_conn { struct bgp_proto *bgp; @@ -113,6 +125,10 @@ struct bgp_conn { u16 peer_gr_time; u8 peer_gr_flags; u8 peer_gr_aflags; + u8 peer_llgr_aware; + u8 peer_llgr_able; + u16 peer_llgr_time; + u8 peer_llgr_aflags; u8 peer_ext_messages_support; /* Peer supports extended message length [draft] */ unsigned hold_time, keepalive_time; /* Times calculated from my and neighbor's requirements */ }; @@ -133,9 +149,10 @@ struct bgp_proto { int rr_client; /* Whether neighbor is RR client of me */ int rs_client; /* Whether neighbor is RS client of me */ u8 gr_ready; /* Neighbor could do graceful restart */ - u8 gr_active; /* Neighbor is doing graceful restart */ + u8 gr_active; /* Neighbor is doing graceful restart (BGP_GRS_*) */ u8 feed_state; /* Feed state (TX) for EoR, RR packets, see BFS_* */ u8 load_state; /* Load state (RX) for EoR, RR packets, see BFS_* */ + uint stale_time; /* Long-lived stale time for LLGR */ struct bgp_conn *conn; /* Connection we have established */ struct bgp_conn outgoing_conn; /* Outgoing connection we're working with */ struct bgp_conn incoming_conn; /* Incoming connection we have neither accepted nor rejected yet */ @@ -252,6 +269,7 @@ int bgp_get_attr(struct eattr *e, byte *buf, int buflen); int bgp_rte_better(struct rte *, struct rte *); int bgp_rte_mergable(rte *pri, rte *sec); int bgp_rte_recalculate(rtable *table, net *net, rte *new, rte *old, rte *old_best); +struct rte *bgp_rte_modify_stale(struct rte *r, struct linpool *pool); void bgp_rt_notify(struct proto *P, rtable *tbl UNUSED, net *n, rte *new, rte *old UNUSED, ea_list *attrs); int bgp_import_control(struct proto *, struct rte **, struct ea_list **, struct linpool *); void bgp_init_bucket_table(struct bgp_proto *); @@ -398,6 +416,9 @@ void bgp_log_error(struct bgp_proto *p, u8 class, char *msg, unsigned code, unsi #define BGP_COMM_NO_ADVERTISE 0xffffff02 /* Don't export at all */ #define BGP_COMM_NO_EXPORT_SUBCONFED 0xffffff03 /* NO_EXPORT even in local confederation */ +#define BGP_COMM_LLGR_STALE 0xffff0006 /* Route is stale according to LLGR */ +#define BGP_COMM_NO_LLGR 0xffff0007 /* Do not treat the route according to LLGR */ + /* Origins */ #define ORIGIN_IGP 0 |