+// SPDX-License-Identifier: GPL-2.0-or-later
/* BGP message definition header.
* Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro
- *
- * This file is part of GNU Zebra.
- *
- * GNU Zebra is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * GNU Zebra is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _QUAGGA_BGPD_H
#include "vty.h"
#include "srv6.h"
#include "iana_afi.h"
+#include "asn.h"
/* For union sockunion. */
#include "queue.h"
};
/* Typedef BGP specific types. */
-typedef uint32_t as_t;
typedef uint16_t as16_t; /* we may still encounter 16 Bit asnums */
typedef uint16_t bgp_size_t;
/* should be mpls_label_t? */
uint32_t tovpn_label; /* may be MPLS_LABEL_NONE */
uint32_t tovpn_zebra_vrf_label_last_sent;
+ char *tovpn_rd_pretty;
struct prefix_rd tovpn_rd;
struct prefix tovpn_nexthop; /* unset => set to 0 */
uint32_t flags;
char locator_name[SRV6_LOCNAME_SIZE];
};
+struct as_confed {
+ as_t as;
+ char *as_pretty;
+};
+
/* BGP instance structure. */
struct bgp {
/* AS number of this BGP instance. */
as_t as;
+ char *as_pretty;
/* Name of this BGP instance. */
char *name;
uint16_t config;
#define BGP_CONFIG_CLUSTER_ID (1 << 0)
#define BGP_CONFIG_CONFEDERATION (1 << 1)
+#define BGP_CONFIG_ASNOTATION (1 << 2)
/* BGP router identifier. */
struct in_addr router_id;
/* BGP confederation information. */
as_t confed_id;
- as_t *confed_peers;
+ char *confed_id_pretty;
+ struct as_confed *confed_peers;
int confed_peers_cnt;
struct thread
/* RD for this VRF */
struct prefix_rd vrf_prd;
+ char *vrf_prd_pretty;
/* import rt list for the vrf instance */
struct list *vrf_import_rtl;
bool allow_martian;
+ enum asnotation_mode asnotation;
+
QOBJ_FIELDS;
};
DECLARE_QOBJ_TYPE(bgp);
/* Peer's remote AS number. */
int as_type;
as_t as;
+ /* for vty as format */
+ char *as_pretty;
/* Peer's local AS number. */
as_t local_as;
/* Peer's Change local AS number. */
as_t change_local_as;
+ /* for vty as format */
+ char *change_local_as_pretty;
/* Remote router ID. */
struct in_addr remote_id;
#define PEER_CAP_GRACEFUL_RESTART_N_BIT_RCV (1U << 24)
#define PEER_CAP_ROLE_ADV (1U << 25) /* role advertised */
#define PEER_CAP_ROLE_RCV (1U << 26) /* role received */
+#define PEER_CAP_SOFT_VERSION_ADV (1U << 27)
+#define PEER_CAP_SOFT_VERSION_RCV (1U << 28)
/* Capability flags (reset in bgp_stop) */
uint32_t af_cap[AFI_MAX][SAFI_MAX];
* so if a flag is unset, the corresponding override flag is unset too.
* However if a flag is set, the corresponding override flag is set.
*/
- uint32_t flags_override;
+ uint64_t flags_override;
/*
* Parallel array to flags that indicates whether the default behavior
* of *flags_override* should be inverted. If a flag is unset and the
* inversion state of the flag differs between peer and peer-group, the
* newly set value must equal to the inverted state of the peer-group.
*/
- uint32_t flags_invert;
+ uint64_t flags_invert;
/*
* Effective array for storing the peer/peer-group flags. In case of a
* peer-group, the peer-specific overrides (see flags_override and
* flags_invert) must be respected.
+ * When changing the structure of flags/af_flags, do not forget to
+ * change flags_invert/flags_override too.
*/
uint64_t flags;
#define PEER_FLAG_PASSIVE (1ULL << 0) /* passive mode */
#define PEER_FLAG_PORT (1ULL << 33)
#define PEER_FLAG_AIGP (1ULL << 34)
#define PEER_FLAG_GRACEFUL_SHUTDOWN (1ULL << 35)
+#define PEER_FLAG_CAPABILITY_SOFT_VERSION (1ULL << 36)
/*
*GR-Disabled mode means unset PEER_FLAG_GRACEFUL_RESTART
/* Path attributes treat-as-withdraw */
bool withdraw_attrs[BGP_ATTR_MAX];
+ /* BGP Software Version Capability */
+#define BGP_MAX_SOFT_VERSION 64
+ char *soft_version;
+
QOBJ_FIELDS;
};
DECLARE_QOBJ_TYPE(peer);
extern struct peer *peer_create(union sockunion *su, const char *conf_if,
struct bgp *bgp, as_t local_as, as_t remote_as,
int as_type, struct peer_group *group,
- bool config_node);
+ bool config_node, const char *as_str);
extern struct peer *peer_create_accept(struct bgp *);
extern void peer_xfer_config(struct peer *dst, struct peer *src);
extern char *peer_uptime(time_t uptime2, char *buf, size_t len, bool use_json,
/* unset the bgp no-rib option during runtime and reset all peers */
extern void bgp_option_norib_unset_runtime(void);
-extern int bgp_get(struct bgp **, as_t *, const char *, enum bgp_instance_type);
+extern int bgp_get(struct bgp **bgp, as_t *as, const char *name,
+ enum bgp_instance_type kind, const char *as_pretty,
+ enum asnotation_mode asnotation);
extern void bgp_instance_up(struct bgp *);
extern void bgp_instance_down(struct bgp *);
extern int bgp_delete(struct bgp *);
extern void bgp_cluster_id_set(struct bgp *bgp, struct in_addr *cluster_id);
extern void bgp_cluster_id_unset(struct bgp *bgp);
-extern void bgp_confederation_id_set(struct bgp *bgp, as_t as);
+extern void bgp_confederation_id_set(struct bgp *bgp, as_t as,
+ const char *as_str);
extern void bgp_confederation_id_unset(struct bgp *bgp);
extern bool bgp_confederation_peers_check(struct bgp *, as_t);
-extern void bgp_confederation_peers_add(struct bgp *bgp, as_t as);
+extern void bgp_confederation_peers_add(struct bgp *bgp, as_t as,
+ const char *as_str);
extern void bgp_confederation_peers_remove(struct bgp *bgp, as_t as);
extern void bgp_timers_set(struct bgp *, uint32_t keepalive, uint32_t holdtime,
extern bool bgp_update_delay_active(struct bgp *);
extern bool bgp_update_delay_configured(struct bgp *);
extern bool bgp_afi_safi_peer_exists(struct bgp *bgp, afi_t afi, safi_t safi);
-extern void peer_as_change(struct peer *, as_t, int);
-extern int peer_remote_as(struct bgp *, union sockunion *, const char *, as_t *,
- int);
-extern int peer_group_remote_as(struct bgp *, const char *, as_t *, int);
+extern void peer_as_change(struct peer *peer, as_t as, int as_type,
+ const char *as_str);
+extern int peer_remote_as(struct bgp *bgp, union sockunion *su,
+ const char *conf_if, as_t *as, int as_type,
+ const char *as_str);
+extern int peer_group_remote_as(struct bgp *bgp, const char *peer_str, as_t *as,
+ int as_type, const char *as_str);
extern int peer_delete(struct peer *peer);
extern void peer_notify_unconfig(struct peer *peer);
extern int peer_group_delete(struct peer_group *);
extern int peer_allowas_in_set(struct peer *, afi_t, safi_t, int, int);
extern int peer_allowas_in_unset(struct peer *, afi_t, safi_t);
-extern int peer_local_as_set(struct peer *, as_t, bool no_prepend,
- bool replace_as);
+extern int peer_local_as_set(struct peer *peer, as_t as, bool no_prepend,
+ bool replace_as, const char *as_str);
extern int peer_local_as_unset(struct peer *);
extern int peer_prefix_list_set(struct peer *, afi_t, safi_t, int,
extern void bgp_route_map_update_timer(struct thread *thread);
extern const char *bgp_get_name_by_role(uint8_t role);
+extern enum asnotation_mode bgp_get_asnotation(struct bgp *bgp);
extern void bgp_route_map_terminate(void);