mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-09 15:16:17 +00:00
Merge pull request #14373 from donaldsharp/evpn_bgp_bestpath_debug_issues
Evpn bgp bestpath debug issues
This commit is contained in:
commit
92a71ea254
@ -594,7 +594,7 @@ struct bgp_path_info *bgp_get_imported_bpi_ultimate(struct bgp_path_info *info)
|
|||||||
*/
|
*/
|
||||||
int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
|
int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
|
||||||
struct bgp_path_info *exist, int *paths_eq,
|
struct bgp_path_info *exist, int *paths_eq,
|
||||||
struct bgp_maxpaths_cfg *mpath_cfg, int debug,
|
struct bgp_maxpaths_cfg *mpath_cfg, bool debug,
|
||||||
char *pfx_buf, afi_t afi, safi_t safi,
|
char *pfx_buf, afi_t afi, safi_t safi,
|
||||||
enum bgp_path_selection_reason *reason)
|
enum bgp_path_selection_reason *reason)
|
||||||
{
|
{
|
||||||
@ -715,16 +715,6 @@ int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
|
|||||||
* sticky flag.
|
* sticky flag.
|
||||||
*/
|
*/
|
||||||
if (newattr->sticky != existattr->sticky) {
|
if (newattr->sticky != existattr->sticky) {
|
||||||
if (!debug) {
|
|
||||||
prefix2str(new_p, pfx_buf,
|
|
||||||
sizeof(*pfx_buf)
|
|
||||||
* PREFIX2STR_BUFFER);
|
|
||||||
bgp_path_info_path_with_addpath_rx_str(
|
|
||||||
new, new_buf, sizeof(new_buf));
|
|
||||||
bgp_path_info_path_with_addpath_rx_str(
|
|
||||||
exist, exist_buf, sizeof(exist_buf));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newattr->sticky && !existattr->sticky) {
|
if (newattr->sticky && !existattr->sticky) {
|
||||||
*reason = bgp_path_selection_evpn_sticky_mac;
|
*reason = bgp_path_selection_evpn_sticky_mac;
|
||||||
if (debug)
|
if (debug)
|
||||||
@ -1503,9 +1493,14 @@ int bgp_evpn_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
|
|||||||
{
|
{
|
||||||
enum bgp_path_selection_reason reason;
|
enum bgp_path_selection_reason reason;
|
||||||
char pfx_buf[PREFIX2STR_BUFFER] = {};
|
char pfx_buf[PREFIX2STR_BUFFER] = {};
|
||||||
|
bool debug = false;
|
||||||
|
|
||||||
return bgp_path_info_cmp(bgp, new, exist, paths_eq, NULL, 0, pfx_buf,
|
if (debug)
|
||||||
AFI_L2VPN, SAFI_EVPN, &reason);
|
prefix2str(bgp_dest_get_prefix(new->net), pfx_buf,
|
||||||
|
sizeof(pfx_buf));
|
||||||
|
|
||||||
|
return bgp_path_info_cmp(bgp, new, exist, paths_eq, NULL, debug,
|
||||||
|
pfx_buf, AFI_L2VPN, SAFI_EVPN, &reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compare two bgp route entity. Return -1 if new is preferred, 1 if exist
|
/* Compare two bgp route entity. Return -1 if new is preferred, 1 if exist
|
||||||
@ -1519,8 +1514,10 @@ int bgp_path_info_cmp_compatible(struct bgp *bgp, struct bgp_path_info *new,
|
|||||||
{
|
{
|
||||||
int paths_eq;
|
int paths_eq;
|
||||||
int ret;
|
int ret;
|
||||||
ret = bgp_path_info_cmp(bgp, new, exist, &paths_eq, NULL, 0, pfx_buf,
|
bool debug = false;
|
||||||
afi, safi, reason);
|
|
||||||
|
ret = bgp_path_info_cmp(bgp, new, exist, &paths_eq, NULL, debug,
|
||||||
|
pfx_buf, afi, safi, reason);
|
||||||
|
|
||||||
if (paths_eq)
|
if (paths_eq)
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -2708,7 +2705,8 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_dest *dest,
|
|||||||
struct bgp_path_info *pi1;
|
struct bgp_path_info *pi1;
|
||||||
struct bgp_path_info *pi2;
|
struct bgp_path_info *pi2;
|
||||||
struct bgp_path_info *nextpi = NULL;
|
struct bgp_path_info *nextpi = NULL;
|
||||||
int paths_eq, do_mpath, debug;
|
int paths_eq, do_mpath;
|
||||||
|
bool debug;
|
||||||
struct list mp_list;
|
struct list mp_list;
|
||||||
char pfx_buf[PREFIX2STR_BUFFER] = {};
|
char pfx_buf[PREFIX2STR_BUFFER] = {};
|
||||||
char path_buf[PATH_ADDPATH_STR_BUFFER];
|
char path_buf[PATH_ADDPATH_STR_BUFFER];
|
||||||
|
@ -914,7 +914,7 @@ extern void bgp_path_info_add_with_caller(const char *caller,
|
|||||||
extern void bgp_aggregate_free(struct bgp_aggregate *aggregate);
|
extern void bgp_aggregate_free(struct bgp_aggregate *aggregate);
|
||||||
extern int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
|
extern int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
|
||||||
struct bgp_path_info *exist, int *paths_eq,
|
struct bgp_path_info *exist, int *paths_eq,
|
||||||
struct bgp_maxpaths_cfg *mpath_cfg, int debug,
|
struct bgp_maxpaths_cfg *mpath_cfg, bool debug,
|
||||||
char *pfx_buf, afi_t afi, safi_t safi,
|
char *pfx_buf, afi_t afi, safi_t safi,
|
||||||
enum bgp_path_selection_reason *reason);
|
enum bgp_path_selection_reason *reason);
|
||||||
#define bgp_path_info_add(A, B) \
|
#define bgp_path_info_add(A, B) \
|
||||||
|
40
lib/prefix.h
40
lib/prefix.h
@ -377,9 +377,9 @@ static inline void ipv4_addr_copy(struct in_addr *dst,
|
|||||||
#endif /*s6_addr32*/
|
#endif /*s6_addr32*/
|
||||||
|
|
||||||
/* Prototypes. */
|
/* Prototypes. */
|
||||||
extern int str2family(const char *);
|
extern int str2family(const char *string);
|
||||||
extern int afi2family(afi_t);
|
extern int afi2family(afi_t afi);
|
||||||
extern afi_t family2afi(int);
|
extern afi_t family2afi(int family);
|
||||||
extern const char *family2str(int family);
|
extern const char *family2str(int family);
|
||||||
extern const char *safi2str(safi_t safi);
|
extern const char *safi2str(safi_t safi);
|
||||||
extern const char *afi2str(afi_t afi);
|
extern const char *afi2str(afi_t afi);
|
||||||
@ -409,14 +409,15 @@ extern void prefix_free(struct prefix **p);
|
|||||||
extern void prefix_free_lists(void *arg);
|
extern void prefix_free_lists(void *arg);
|
||||||
extern const char *prefix_family_str(union prefixconstptr pu);
|
extern const char *prefix_family_str(union prefixconstptr pu);
|
||||||
extern int prefix_blen(union prefixconstptr pu);
|
extern int prefix_blen(union prefixconstptr pu);
|
||||||
extern int str2prefix(const char *, struct prefix *);
|
extern int str2prefix(const char *string, struct prefix *prefix);
|
||||||
|
|
||||||
#define PREFIX2STR_BUFFER PREFIX_STRLEN
|
#define PREFIX2STR_BUFFER PREFIX_STRLEN
|
||||||
|
|
||||||
extern void prefix_mcast_inet4_dump(const char *onfail, struct in_addr addr,
|
extern void prefix_mcast_inet4_dump(const char *onfail, struct in_addr addr,
|
||||||
char *buf, int buf_size);
|
char *buf, int buf_size);
|
||||||
extern const char *prefix_sg2str(const struct prefix_sg *sg, char *str);
|
extern const char *prefix_sg2str(const struct prefix_sg *sg, char *str);
|
||||||
extern const char *prefix2str(union prefixconstptr, char *, int);
|
extern const char *prefix2str(union prefixconstptr upfx, char *buffer,
|
||||||
|
int size);
|
||||||
extern int evpn_type5_prefix_match(const struct prefix *evpn_pfx,
|
extern int evpn_type5_prefix_match(const struct prefix *evpn_pfx,
|
||||||
const struct prefix *match_pfx);
|
const struct prefix *match_pfx);
|
||||||
extern int prefix_match(union prefixconstptr unet, union prefixconstptr upfx);
|
extern int prefix_match(union prefixconstptr unet, union prefixconstptr upfx);
|
||||||
@ -437,36 +438,37 @@ extern bool evpn_addr_same(const struct evpn_addr *e1, const struct evpn_addr *e
|
|||||||
#define prefix_copy(a, b) ({ memset(a, 0, sizeof(*a)); prefix_copy(a, b); })
|
#define prefix_copy(a, b) ({ memset(a, 0, sizeof(*a)); prefix_copy(a, b); })
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern struct prefix *sockunion2hostprefix(const union sockunion *,
|
extern struct prefix *sockunion2hostprefix(const union sockunion *su,
|
||||||
struct prefix *p);
|
struct prefix *p);
|
||||||
extern void prefix2sockunion(const struct prefix *, union sockunion *);
|
extern void prefix2sockunion(const struct prefix *p, union sockunion *su);
|
||||||
|
|
||||||
extern int str2prefix_eth(const char *, struct prefix_eth *);
|
extern int str2prefix_eth(const char *string, struct prefix_eth *p);
|
||||||
|
|
||||||
extern struct prefix_ipv4 *prefix_ipv4_new(void);
|
extern struct prefix_ipv4 *prefix_ipv4_new(void);
|
||||||
extern void prefix_ipv4_free(struct prefix_ipv4 **p);
|
extern void prefix_ipv4_free(struct prefix_ipv4 **p);
|
||||||
extern int str2prefix_ipv4(const char *, struct prefix_ipv4 *);
|
extern int str2prefix_ipv4(const char *string, struct prefix_ipv4 *p);
|
||||||
extern void apply_mask_ipv4(struct prefix_ipv4 *);
|
extern void apply_mask_ipv4(struct prefix_ipv4 *p);
|
||||||
|
|
||||||
extern int prefix_ipv4_any(const struct prefix_ipv4 *);
|
extern int prefix_ipv4_any(const struct prefix_ipv4 *p);
|
||||||
extern void apply_classful_mask_ipv4(struct prefix_ipv4 *);
|
extern void apply_classful_mask_ipv4(struct prefix_ipv4 *p);
|
||||||
|
|
||||||
extern uint8_t ip_masklen(struct in_addr);
|
extern uint8_t ip_masklen(struct in_addr addr);
|
||||||
extern void masklen2ip(const int, struct in_addr *);
|
extern void masklen2ip(const int length, struct in_addr *addr);
|
||||||
/* given the address of a host on a network and the network mask length,
|
/* given the address of a host on a network and the network mask length,
|
||||||
* calculate the broadcast address for that network;
|
* calculate the broadcast address for that network;
|
||||||
* special treatment for /31 according to RFC3021 section 3.3 */
|
* special treatment for /31 according to RFC3021 section 3.3 */
|
||||||
extern in_addr_t ipv4_broadcast_addr(in_addr_t hostaddr, int masklen);
|
extern in_addr_t ipv4_broadcast_addr(in_addr_t hostaddr, int masklen);
|
||||||
|
|
||||||
extern int netmask_str2prefix_str(const char *, const char *, char *, size_t);
|
extern int netmask_str2prefix_str(const char *net_str, const char *mask_str,
|
||||||
|
char *prefix_str, size_t prefix_str_len);
|
||||||
|
|
||||||
extern struct prefix_ipv6 *prefix_ipv6_new(void);
|
extern struct prefix_ipv6 *prefix_ipv6_new(void);
|
||||||
extern void prefix_ipv6_free(struct prefix_ipv6 **p);
|
extern void prefix_ipv6_free(struct prefix_ipv6 **p);
|
||||||
extern int str2prefix_ipv6(const char *, struct prefix_ipv6 *);
|
extern int str2prefix_ipv6(const char *str, struct prefix_ipv6 *p);
|
||||||
extern void apply_mask_ipv6(struct prefix_ipv6 *);
|
extern void apply_mask_ipv6(struct prefix_ipv6 *p);
|
||||||
|
|
||||||
extern int ip6_masklen(struct in6_addr);
|
extern int ip6_masklen(struct in6_addr netmask);
|
||||||
extern void masklen2ip6(const int, struct in6_addr *);
|
extern void masklen2ip6(const int masklen, struct in6_addr *netmask);
|
||||||
|
|
||||||
extern int is_zero_mac(const struct ethaddr *mac);
|
extern int is_zero_mac(const struct ethaddr *mac);
|
||||||
extern bool is_mcast_mac(const struct ethaddr *mac);
|
extern bool is_mcast_mac(const struct ethaddr *mac);
|
||||||
|
Loading…
Reference in New Issue
Block a user