This diff just renames F_CTL_ACTIVE and F_PREF_ACTIVE to the more correct
F_CTL_BEST and F_PREF_BEST. The flags are used to mark the one best path.
ACTIVE is not the right term here since with ECMP and add-path more than
one route can be active. I will probably add more flags to mark ECMP
prefixes but more changes are needed for that.
--
:wq Claudio
Index: usr.sbin/bgpctl/bgpctl.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpctl/bgpctl.c,v
retrieving revision 1.275
diff -u -p -r1.275 bgpctl.c
--- usr.sbin/bgpctl/bgpctl.c 6 Feb 2022 09:52:32 -0000 1.275
+++ usr.sbin/bgpctl/bgpctl.c 21 Mar 2022 09:48:13 -0000
@@ -697,7 +697,7 @@ fmt_flags(uint8_t flags, int sum)
*p++ = 'S';
if (flags & F_PREF_ELIGIBLE)
*p++ = '*';
- if (flags & F_PREF_ACTIVE)
+ if (flags & F_PREF_BEST)
*p++ = '>';
*p = '\0';
snprintf(buf, sizeof(buf), "%-5s", flagstr);
@@ -711,7 +711,7 @@ fmt_flags(uint8_t flags, int sum)
strlcat(buf, ", stale", sizeof(buf));
if (flags & F_PREF_ELIGIBLE)
strlcat(buf, ", valid", sizeof(buf));
- if (flags & F_PREF_ACTIVE)
+ if (flags & F_PREF_BEST)
strlcat(buf, ", best", sizeof(buf));
if (flags & F_PREF_ANNOUNCE)
strlcat(buf, ", announced", sizeof(buf));
Index: usr.sbin/bgpctl/output_json.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpctl/output_json.c,v
retrieving revision 1.13
diff -u -p -r1.13 output_json.c
--- usr.sbin/bgpctl/output_json.c 6 Feb 2022 09:52:32 -0000 1.13
+++ usr.sbin/bgpctl/output_json.c 21 Mar 2022 09:48:13 -0000
@@ -875,7 +875,7 @@ json_rib(struct ctl_show_rib *r, u_char
/* flags */
json_do_bool("valid", r->flags & F_PREF_ELIGIBLE);
- if (r->flags & F_PREF_ACTIVE)
+ if (r->flags & F_PREF_BEST)
json_do_bool("best", 1);
if (r->flags & F_PREF_INTERNAL)
json_do_printf("source", "%s", "internal");
Index: usr.sbin/bgpctl/parser.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpctl/parser.c,v
retrieving revision 1.108
diff -u -p -r1.108 parser.c
--- usr.sbin/bgpctl/parser.c 6 Feb 2022 09:52:32 -0000 1.108
+++ usr.sbin/bgpctl/parser.c 21 Mar 2022 09:48:13 -0000
@@ -172,8 +172,8 @@ static const struct token t_show_rib[] =
{ KEYWORD, "community", NONE, t_show_community},
{ KEYWORD, "ext-community", NONE, t_show_extcommunity},
{ KEYWORD, "large-community", NONE, t_show_largecommunity},
- { FLAG, "best", F_CTL_ACTIVE, t_show_rib},
- { FLAG, "selected", F_CTL_ACTIVE, t_show_rib},
+ { FLAG, "best", F_CTL_BEST, t_show_rib},
+ { FLAG, "selected", F_CTL_BEST, t_show_rib},
{ FLAG, "detail", F_CTL_DETAIL, t_show_rib},
{ FLAG, "error", F_CTL_INVALID, t_show_rib},
{ FLAG, "ssv" , F_CTL_SSV, t_show_rib},
Index: usr.sbin/bgpd/bgpd.h
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/bgpd.h,v
retrieving revision 1.421
diff -u -p -r1.421 bgpd.h
--- usr.sbin/bgpd/bgpd.h 3 Mar 2022 11:19:41 -0000 1.421
+++ usr.sbin/bgpd/bgpd.h 21 Mar 2022 09:48:39 -0000
@@ -89,7 +89,7 @@
#define F_CTL_DETAIL 0x1000 /* only set on requests */
#define F_CTL_ADJ_IN 0x2000 /* only set on requests */
#define F_CTL_ADJ_OUT 0x4000 /* only set on requests */
-#define F_CTL_ACTIVE 0x8000
+#define F_CTL_BEST 0x8000
#define F_RTLABEL 0x10000
#define F_CTL_SSV 0x20000 /* only used by bgpctl */
#define F_CTL_INVALID 0x40000 /* only set on requests */
@@ -790,7 +790,7 @@ struct ctl_neighbor {
};
#define F_PREF_ELIGIBLE 0x01
-#define F_PREF_ACTIVE 0x02
+#define F_PREF_BEST 0x02
#define F_PREF_INTERNAL 0x04
#define F_PREF_ANNOUNCE 0x08
#define F_PREF_STALE 0x10
Index: usr.sbin/bgpd/rde.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
retrieving revision 1.540
diff -u -p -r1.540 rde.c
--- usr.sbin/bgpd/rde.c 3 Mar 2022 13:06:15 -0000 1.540
+++ usr.sbin/bgpd/rde.c 21 Mar 2022 09:49:08 -0000
@@ -2401,7 +2401,7 @@ rde_dump_rib_as(struct prefix *p, struct
rib.flags = 0;
re = prefix_re(p);
if (re != NULL && re->active == p)
- rib.flags |= F_PREF_ACTIVE;
+ rib.flags |= F_PREF_BEST;
if (!peer->conf.ebgp)
rib.flags |= F_PREF_INTERNAL;
if (asp->flags & F_PREFIX_ANNOUNCED)
@@ -2502,7 +2502,7 @@ rde_dump_filter(struct prefix *p, struct
re = prefix_re(p);
if (asp == NULL) /* skip pending withdraw in Adj-RIB-Out */
return;
- if ((req->flags & F_CTL_ACTIVE) && re != NULL && re->active != p)
+ if ((req->flags & F_CTL_BEST) && re != NULL && re->active != p)
return;
if ((req->flags & F_CTL_INVALID) &&
(asp->flags & F_ATTR_PARSE_ERR) == 0)