]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgpd.h
bgpd: Change single value bitfield to a bool
[mirror_frr.git] / bgpd / bgpd.h
index 360bcc39c42129c90068f2ef2783eb45b9e77366..af07cb4c10a9d329d2b60c6243484886f7d80d98 100644 (file)
@@ -192,11 +192,11 @@ struct bgp_redist {
        struct bgp_rmap rmap;
 };
 
-typedef enum {
+enum vpn_policy_direction {
        BGP_VPN_POLICY_DIR_FROMVPN = 0,
        BGP_VPN_POLICY_DIR_TOVPN = 1,
        BGP_VPN_POLICY_DIR_MAX = 2
-} vpn_policy_direction_t;
+};
 
 struct vpn_policy {
        struct bgp *bgp; /* parent */
@@ -453,7 +453,7 @@ struct bgp {
 #define BGP_LINK_BW_REF_BW                1
 
        /* BGP flags. */
-       uint32_t flags;
+       uint64_t flags;
 #define BGP_FLAG_ALWAYS_COMPARE_MED       (1 << 0)
 #define BGP_FLAG_DETERMINISTIC_MED        (1 << 1)
 #define BGP_FLAG_MED_MISSING_AS_WORST     (1 << 2)
@@ -488,6 +488,10 @@ struct bgp {
 #define BGP_FLAG_SUPPRESS_FIB_PENDING (1 << 26)
 #define BGP_FLAG_SUPPRESS_DUPLICATES (1 << 27)
 #define BGP_FLAG_PEERTYPE_MULTIPATH_RELAX (1 << 29)
+/* Indicate Graceful Restart support for BGP NOTIFICATION messages */
+#define BGP_FLAG_GRACEFUL_NOTIFICATION (1 << 30)
+/* Send Hard Reset CEASE Notification for 'Administrative Reset' */
+#define BGP_FLAG_HARD_ADMIN_RESET (1 << 31)
 
        /* BGP default address-families.
         * New peers inherit enabled afi/safis from bgp instance.
@@ -616,8 +620,7 @@ struct bgp {
        struct bgp_maxpaths_cfg {
                uint16_t maxpaths_ebgp;
                uint16_t maxpaths_ibgp;
-               uint16_t ibgp_flags;
-#define BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN (1 << 0)
+               bool same_clusterlen;
        } maxpaths[AFI_MAX][SAFI_MAX];
 
        _Atomic uint32_t wpkt_quanta; // max # packets to write per i/o cycle
@@ -819,6 +822,7 @@ struct bgp_notify {
        char *data;
        bgp_size_t length;
        uint8_t *raw_data;
+       bool hard_reset;
 };
 
 /* Next hop self address. */
@@ -901,13 +905,13 @@ struct bgp_filter {
 
 /* IBGP/EBGP identifier.  We also have a CONFED peer, which is to say,
    a peer who's AS is part of our Confederation.  */
-typedef enum {
+enum bgp_peer_sort {
        BGP_PEER_UNSPECIFIED,
        BGP_PEER_IBGP,
        BGP_PEER_EBGP,
        BGP_PEER_INTERNAL,
        BGP_PEER_CONFED,
-} bgp_peer_sort_t;
+};
 
 /* BGP message header and packet size.  */
 #define BGP_MARKER_SIZE                                16
@@ -1084,7 +1088,7 @@ struct peer {
        /* Peer's local AS number. */
        as_t local_as;
 
-       bgp_peer_sort_t sort;
+       enum bgp_peer_sort sort;
 
        /* Peer's Change local AS number. */
        as_t change_local_as;
@@ -1176,8 +1180,10 @@ struct peer {
 #define PEER_CAP_RESTART_RCV                (1U << 6) /* restart received */
 #define PEER_CAP_AS4_ADV                    (1U << 7) /* as4 advertised */
 #define PEER_CAP_AS4_RCV                    (1U << 8) /* as4 received */
-#define PEER_CAP_RESTART_BIT_ADV            (1U << 9) /* sent restart state */
-#define PEER_CAP_RESTART_BIT_RCV            (1U << 10) /* peer restart state */
+/* sent graceful-restart restart (R) bit */
+#define PEER_CAP_GRACEFUL_RESTART_R_BIT_ADV (1U << 9)
+/* received graceful-restart restart (R) bit */
+#define PEER_CAP_GRACEFUL_RESTART_R_BIT_RCV (1U << 10)
 #define PEER_CAP_ADDPATH_ADV                (1U << 11) /* addpath advertised */
 #define PEER_CAP_ADDPATH_RCV                (1U << 12) /* addpath received */
 #define PEER_CAP_ENHE_ADV                   (1U << 13) /* Extended nexthop advertised */
@@ -1190,6 +1196,10 @@ struct peer {
 #define PEER_CAP_EXTENDED_MESSAGE_RCV (1U << 20)
 #define PEER_CAP_LLGR_ADV (1U << 21)
 #define PEER_CAP_LLGR_RCV (1U << 22)
+/* sent graceful-restart notification (N) bit */
+#define PEER_CAP_GRACEFUL_RESTART_N_BIT_ADV (1U << 23)
+/* received graceful-restart notification (N) bit */
+#define PEER_CAP_GRACEFUL_RESTART_N_BIT_RCV (1U << 24)
 
        /* Capability flags (reset in bgp_stop) */
        uint32_t af_cap[AFI_MAX][SAFI_MAX];
@@ -1850,6 +1860,7 @@ struct bgp_nlri {
 #define BGP_NOTIFY_CEASE_CONFIG_CHANGE           6
 #define BGP_NOTIFY_CEASE_COLLISION_RESOLUTION    7
 #define BGP_NOTIFY_CEASE_OUT_OF_RESOURCE         8
+#define BGP_NOTIFY_CEASE_HARD_RESET 9
 
 /* BGP_NOTIFY_ROUTE_REFRESH_ERR sub codes (RFC 7313). */
 #define BGP_NOTIFY_ROUTE_REFRESH_INVALID_MSG_LEN 1
@@ -1968,12 +1979,12 @@ enum bgp_create_error_code {
 /*
  * Enumeration of different policy kinds a peer can be configured with.
  */
-typedef enum {
+enum bgp_policy_type {
        BGP_POLICY_ROUTE_MAP,
        BGP_POLICY_FILTER_LIST,
        BGP_POLICY_PREFIX_LIST,
        BGP_POLICY_DISTRIBUTE_LIST,
-} bgp_policy_type_e;
+};
 
 /* peer_flag_change_type. */
 enum peer_change_type {
@@ -2025,8 +2036,8 @@ extern struct peer *peer_unlock_with_caller(const char *, struct peer *);
 #define peer_unlock(A) peer_unlock_with_caller(__FUNCTION__, (A))
 #define peer_lock(B) peer_lock_with_caller(__FUNCTION__, (B))
 
-extern bgp_peer_sort_t peer_sort(struct peer *peer);
-extern bgp_peer_sort_t peer_sort_lookup(struct peer *peer);
+extern enum bgp_peer_sort peer_sort(struct peer *peer);
+extern enum bgp_peer_sort peer_sort_lookup(struct peer *peer);
 
 extern bool peer_active(struct peer *);
 extern bool peer_active_nego(struct peer *);
@@ -2440,7 +2451,7 @@ static inline uint32_t bgp_vrf_interfaces(struct bgp *bgp, bool active)
        if (vrf == NULL)
                return 0;
        RB_FOREACH (ifp, if_name_head, &vrf->ifaces_by_name) {
-               if (strncmp(ifp->name, bgp->name, VRF_NAMSIZ) == 0)
+               if (strcmp(ifp->name, bgp->name) == 0)
                        continue;
                if (!active || if_is_up(ifp))
                        count++;