summaryrefslogtreecommitdiffstats
path: root/bgpd/bgpd.h
diff options
context:
space:
mode:
authorMitch Skiba <mskiba@amazon.com>2018-05-10 01:10:02 +0200
committerMitch Skiba <mskiba@amazon.com>2018-11-10 01:16:36 +0100
commitdcc68b5e2a598a180b370163a7022324a9b5da96 (patch)
tree03c08effdbdff6e77a1871fc2ca65073460d3be3 /bgpd/bgpd.h
parentlib: Implement an allocator for 32 bit ID numbers (diff)
downloadfrr-dcc68b5e2a598a180b370163a7022324a9b5da96.tar.xz
frr-dcc68b5e2a598a180b370163a7022324a9b5da96.zip
bgpd: Re-use TX Addpath IDs where possible
The motivation for this patch is to address a concerning behavior of tx-addpath-bestpath-per-AS. Prior to this patch, all paths' TX ID was pre-determined as the path was received from a peer. However, this meant that any time the path selected as best from an AS changed, bgpd had no choice but to withdraw the previous best path, and advertise the new best-path under a new TX ID. This could cause significant network disruption, especially for the subset of prefixes coming from only one AS that were also communicated over a bestpath-per-AS session. The patch's general approach is best illustrated by txaddpath_update_ids. After a bestpath run (required for best-per-AS to know what will and will not be sent as addpaths) ID numbers will be stripped from paths that no longer need to be sent, and held in a pool. Then, paths that will be sent as addpaths and do not already have ID numbers will allocate new ID numbers, pulling first from that pool. Finally, anything left in the pool will be returned to the allocator. In order for this to work, ID numbers had to be split by strategy. The tx-addpath-All strategy would keep every ID number "in use" constantly, preventing IDs from being transferred to different paths. Rather than create two variables for ID, this patch create a more generic array that will easily enable more addpath strategies to be implemented. The previously described ID manipulations will happen per addpath strategy, and will only be run for strategies that are enabled on at least one peer. Finally, the ID numbers are allocated from an allocator that tracks per AFI/SAFI/Addpath Strategy which IDs are in use. Though it would be very improbable, there was the possibility with the free-running counter approach for rollover to cause two paths on the same prefix to get assigned the same TX ID. As remote as the possibility is, we prefer to not leave it to chance. This ID re-use method is not perfect. In some cases you could still get withdraw-then-add behaviors where not strictly necessary. In the case of bestpath-per-AS this requires one AS to advertise a prefix for the first time, then a second AS withdraws that prefix, all within the space of an already pending MRAI timer. In those situations a withdraw-then-add is more forgivable, and fixing it would probably require a much more significant effort, as IDs would need to be moved to ADVs instead of paths. Signed-off-by Mitchell Skiba <mskiba@amazon.com>
Diffstat (limited to 'bgpd/bgpd.h')
-rw-r--r--bgpd/bgpd.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index e14b0f39e..5ee54e3c7 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -39,6 +39,7 @@
#include "bitfield.h"
#include "vxlan.h"
#include "bgp_labelpool.h"
+#include "bgp_addpath_types.h"
#define BGP_MAX_HOSTNAME 64 /* Linux max, is larger than most other sys */
#define BGP_PEER_MAX_HASH_SIZE 16384
@@ -462,8 +463,7 @@ struct bgp {
/* Auto-shutdown new peers */
bool autoshutdown;
- uint32_t addpath_tx_id;
- int addpath_tx_used[AFI_MAX][SAFI_MAX];
+ struct bgp_addpath_bgp_data tx_addpath;
#if ENABLE_BGP_VNC
struct rfapi_cfg *rfapi_cfg;
@@ -938,12 +938,12 @@ struct peer {
#define PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE (1 << 19) /* remove-private-as replace-as */
#define PEER_FLAG_AS_OVERRIDE (1 << 20) /* as-override */
#define PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE (1 << 21) /* remove-private-as all replace-as */
-#define PEER_FLAG_ADDPATH_TX_ALL_PATHS (1 << 22) /* addpath-tx-all-paths */
-#define PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS (1 << 23) /* addpath-tx-bestpath-per-AS */
#define PEER_FLAG_WEIGHT (1 << 24) /* weight */
#define PEER_FLAG_ALLOWAS_IN_ORIGIN (1 << 25) /* allowas-in origin */
#define PEER_FLAG_SEND_LARGE_COMMUNITY (1 << 26) /* Send large Communities */
+ enum bgp_addpath_strat addpath_type[AFI_MAX][SAFI_MAX];
+
/* MD5 password */
char *password;
@@ -1466,6 +1466,14 @@ typedef enum {
BGP_POLICY_DISTRIBUTE_LIST,
} bgp_policy_type_e;
+/* peer_flag_change_type. */
+enum peer_change_type {
+ peer_change_none,
+ peer_change_reset,
+ peer_change_reset_in,
+ peer_change_reset_out,
+};
+
extern struct bgp_master *bm;
extern unsigned int multipath_num;
@@ -1597,6 +1605,8 @@ extern int peer_af_flag_unset(struct peer *, afi_t, safi_t, uint32_t);
extern int peer_af_flag_check(struct peer *, afi_t, safi_t, uint32_t);
extern void peer_af_flag_inherit(struct peer *peer, afi_t afi, safi_t safi,
uint32_t flag);
+extern void peer_change_action(struct peer *peer, afi_t afi, safi_t safi,
+ enum peer_change_type type);
extern int peer_ebgp_multihop_set(struct peer *, int);
extern int peer_ebgp_multihop_unset(struct peer *);