--- embedaddon/bird/proto/bgp/bgp.h 2017/08/22 12:33:54 1.1 +++ embedaddon/bird/proto/bgp/bgp.h 2021/03/17 19:50:23 1.1.1.2 @@ -48,11 +48,14 @@ struct bgp_config { int passive; /* Do not initiate outgoing connection */ int interpret_communities; /* Hardwired handling of well-known communities */ int secondary; /* Accept also non-best routes (i.e. RA_ACCEPTED) */ - int add_path; /* Use ADD-PATH extension [draft] */ + int add_path; /* Use ADD-PATH extension [RFC7911] */ 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; @@ -61,6 +64,7 @@ struct bgp_config { unsigned error_delay_time_min; /* Time to wait after an error is detected */ unsigned error_delay_time_max; unsigned disable_after_error; /* Disable the protocol when error is detected */ + u32 disable_after_cease; /* Disable it when cease is received, bitfield */ char *password; /* Password used for MD5 authentication */ struct rtable_config *igp_table; /* Table used for recursive next hop lookups */ @@ -88,7 +92,19 @@ 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) */ + +#define BGP_BFD_GRACEFUL 2 /* BFD down triggers graceful restart */ + + struct bgp_conn { struct bgp_proto *bgp; struct birdsock *sk; @@ -104,13 +120,17 @@ struct bgp_conn { int start_state; /* protocol start_state snapshot when connection established */ u8 peer_refresh_support; /* Peer supports route refresh [RFC2918] */ u8 peer_as4_support; /* Peer supports 4B AS numbers [RFC4893] */ - u8 peer_add_path; /* Peer supports ADD-PATH [draft] */ + u8 peer_add_path; /* Peer supports ADD-PATH [RFC7911] */ u8 peer_enhanced_refresh_support; /* Peer supports enhanced refresh [RFC7313] */ u8 peer_gr_aware; u8 peer_gr_able; u16 peer_gr_time; u8 peer_gr_flags; u8 peer_gr_aflags; + u8 peer_llgr_aware; + u8 peer_llgr_able; + uint 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 */ }; @@ -131,9 +151,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 */ @@ -211,7 +232,7 @@ void bgp_graceful_restart_done(struct bgp_proto *p); void bgp_refresh_begin(struct bgp_proto *p); void bgp_refresh_end(struct bgp_proto *p); void bgp_store_error(struct bgp_proto *p, struct bgp_conn *c, u8 class, u32 code); -void bgp_stop(struct bgp_proto *p, unsigned subcode); +void bgp_stop(struct bgp_proto *p, uint subcode, byte *data, uint len); struct rte_source *bgp_find_source(struct bgp_proto *p, u32 path_id); struct rte_source *bgp_get_source(struct bgp_proto *p, u32 path_id); @@ -250,6 +271,7 @@ int bgp_get_attr(struct eattr *e, byte *buf, int bufle 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 *); @@ -266,7 +288,7 @@ inline static void bgp_attach_attr_ip(struct ea_list * /* packets.c */ -void mrt_dump_bgp_state_change(struct bgp_conn *conn, unsigned old, unsigned new); +void bgp_dump_state_change(struct bgp_conn *conn, uint old, uint new); void bgp_schedule_packet(struct bgp_conn *conn, int type); void bgp_kick_tx(void *vconn); void bgp_tx(struct birdsock *sk); @@ -310,7 +332,7 @@ void bgp_log_error(struct bgp_proto *p, u8 class, char #define BA_EXT_COMMUNITY 0x10 /* [RFC4360] */ #define BA_AS4_PATH 0x11 /* [RFC4893] */ #define BA_AS4_AGGREGATOR 0x12 -#define BA_LARGE_COMMUNITY 0x20 /* [draft-ietf-idr-large-community] */ +#define BA_LARGE_COMMUNITY 0x20 /* [RFC8092] */ /* BGP connection states */ @@ -395,6 +417,9 @@ void bgp_log_error(struct bgp_proto *p, u8 class, char #define BGP_COMM_NO_EXPORT 0xffffff01 /* Don't export outside local AS / confed. */ #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 */