]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgpd.h
lib: enforce vrf_name_to_id by returning default_vrf when name is null
[mirror_frr.git] / bgpd / bgpd.h
index ebcb9b5ea243a2a061afb80710dcdb661af3572a..62096d651affee5e1d2930c2aed63d30798bb12e 100644 (file)
@@ -24,6 +24,7 @@
 #include "qobj.h"
 #include <pthread.h>
 
+#include "frr_pthread.h"
 #include "lib/json.h"
 #include "vrf.h"
 #include "vty.h"
@@ -38,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
@@ -97,6 +99,9 @@ enum bgp_af_index {
        for (afi = AFI_IP; afi < AFI_MAX; afi++)                               \
                for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
 
+extern struct frr_pthread *bgp_pth_io;
+extern struct frr_pthread *bgp_pth_ka;
+
 /* BGP master for system wide configurations and variables.  */
 struct bgp_master {
        /* BGP instance list.  */
@@ -105,10 +110,6 @@ struct bgp_master {
        /* BGP thread master.  */
        struct thread_master *master;
 
-/* BGP pthreads. */
-#define PTHREAD_IO              (1 << 1)
-#define PTHREAD_KEEPALIVES      (1 << 2)
-
        /* work queues */
        struct work_queue *process_main_queue;
 
@@ -130,6 +131,7 @@ struct bgp_master {
 #define BGP_OPT_MULTIPLE_INSTANCE        (1 << 1)
 #define BGP_OPT_CONFIG_CISCO             (1 << 2)
 #define BGP_OPT_NO_LISTEN                (1 << 3)
+#define BGP_OPT_NO_ZEBRA                 (1 << 4)
 
        uint64_t updgrp_idspace;
        uint64_t subgrp_idspace;
@@ -368,7 +370,6 @@ struct bgp {
 /* vrf-route leaking flags */
 #define BGP_CONFIG_VRF_TO_VRF_IMPORT                   (1 << 7)
 #define BGP_CONFIG_VRF_TO_VRF_EXPORT                   (1 << 8)
-#define BGP_DEFAULT_NAME               "default"
 
        /* Route table for next-hop lookup cache. */
        struct bgp_table *nexthop_cache_table[AFI_MAX];
@@ -463,8 +464,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;
@@ -482,9 +482,16 @@ struct bgp {
        /* EVPN enable - advertise local VNIs and their MACs etc. */
        int advertise_all_vni;
 
+       struct bgp_evpn_info *evpn_info;
+
        /* EVPN - use RFC 8365 to auto-derive RT */
        int advertise_autort_rfc8365;
 
+       /*
+        * Flooding mechanism for BUM packets for VxLAN-EVPN.
+        */
+       enum vxlan_flood_control vxlan_flood_ctrl;
+
        /* Hash table of Import RTs to EVIs */
        struct hash *import_rt_hash;
 
@@ -537,6 +544,9 @@ struct bgp {
        /* local esi hash table */
        struct hash *esihash;
 
+       /* Count of peers in established state */
+       uint32_t established_peers;
+
        QOBJ_FIELDS
 };
 DECLARE_QOBJ_TYPE(bgp)
@@ -934,12 +944,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;
 
@@ -999,7 +1009,7 @@ struct peer {
        struct thread *t_process_packet;
 
        /* Thread flags. */
-       _Atomic uint16_t thread_flags;
+       _Atomic uint32_t thread_flags;
 #define PEER_THREAD_WRITES_ON         (1 << 0)
 #define PEER_THREAD_READS_ON          (1 << 1)
 #define PEER_THREAD_KEEPALIVES_ON     (1 << 2)
@@ -1462,6 +1472,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;
 
@@ -1593,6 +1611,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 *);
@@ -1605,8 +1625,9 @@ extern int peer_update_source_if_set(struct peer *, const char *);
 extern int peer_update_source_addr_set(struct peer *, const union sockunion *);
 extern int peer_update_source_unset(struct peer *);
 
-extern int peer_default_originate_set(struct peer *, afi_t, safi_t,
-                                     const char *);
+extern int peer_default_originate_set(struct peer *peer, afi_t afi, safi_t safi,
+                                     const char *rmap,
+                                     struct route_map *route_map);
 extern int peer_default_originate_unset(struct peer *, afi_t, safi_t);
 
 extern int peer_port_set(struct peer *, uint16_t);
@@ -1644,10 +1665,13 @@ extern int peer_prefix_list_unset(struct peer *, afi_t, safi_t, int);
 extern int peer_aslist_set(struct peer *, afi_t, safi_t, int, const char *);
 extern int peer_aslist_unset(struct peer *, afi_t, safi_t, int);
 
-extern int peer_route_map_set(struct peer *, afi_t, safi_t, int, const char *);
+extern int peer_route_map_set(struct peer *peer, afi_t afi, safi_t safi, int,
+                             const char *name, struct route_map *route_map);
 extern int peer_route_map_unset(struct peer *, afi_t, safi_t, int);
 
-extern int peer_unsuppress_map_set(struct peer *, afi_t, safi_t, const char *);
+extern int peer_unsuppress_map_set(struct peer *peer, afi_t afi, safi_t safi,
+                                  const char *name,
+                                  struct route_map *route_map);
 
 extern int peer_password_set(struct peer *, const char *);
 extern int peer_password_unset(struct peer *);
@@ -1867,5 +1891,4 @@ extern void bgp_update_redist_vrf_bitmaps(struct bgp *, vrf_id_t);
 
 /* For benefit of rfapi */
 extern struct peer *peer_new(struct bgp *bgp);
-
 #endif /* _QUAGGA_BGPD_H */