bgp: Add a 15 minute warning to missing policy

Add a 15 minute warning to the logging system when
bgp policy is not setup properly.  Operators keep asking
about the missing policy( on upgrade typically ).  Let's
try to give them a bit more of a hint when something is
going wrong as that they are clearly missing the other
various places FRR tells them about it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit b17826b715)
This commit is contained in:
Donald Sharp 2022-02-14 07:57:45 -05:00 committed by mergify-bot
parent c432b3c775
commit aeb1da0ca2
3 changed files with 23 additions and 1 deletions

View File

@ -2219,8 +2219,16 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi,
* implementations.
*/
if (CHECK_FLAG(bgp->flags, BGP_FLAG_EBGP_REQUIRES_POLICY))
if (!bgp_outbound_policy_exists(peer, filter))
if (!bgp_outbound_policy_exists(peer, filter)) {
if (monotime_since(&bgp->ebgprequirespolicywarning,
NULL) > FIFTEENMINUTE2USEC ||
bgp->ebgprequirespolicywarning.tv_sec == 0) {
zlog_warn(
"EBGP inbound/outbound policy not properly setup, please configure in order for your peering to work correctly");
monotime(&bgp->ebgprequirespolicywarning);
}
return false;
}
/* draft-ietf-idr-deprecate-as-set-confed-set
* Filter routes having AS_SET or AS_CONFED_SET in the path.
@ -3841,6 +3849,13 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
if (!bgp_inbound_policy_exists(peer,
&peer->filter[afi][safi])) {
reason = "inbound policy missing";
if (monotime_since(&bgp->ebgprequirespolicywarning,
NULL) > FIFTEENMINUTE2USEC ||
bgp->ebgprequirespolicywarning.tv_sec == 0) {
zlog_warn(
"EBGP inbound/outbound policy not properly setup, please configure in order for your peering to work correctly");
monotime(&bgp->ebgprequirespolicywarning);
}
goto filtered;
}

View File

@ -3239,6 +3239,10 @@ static struct bgp *bgp_create(as_t *as, const char *name,
/*initilize global GR FSM */
bgp_global_gr_init(bgp);
memset(&bgp->ebgprequirespolicywarning, 0,
sizeof(bgp->ebgprequirespolicywarning));
return bgp;
}

View File

@ -759,6 +759,9 @@ struct bgp {
struct list *srv6_locator_chunks;
struct list *srv6_functions;
struct timeval ebgprequirespolicywarning;
#define FIFTEENMINUTE2USEC (int64_t)15 * 60 * 1000000
QOBJ_FIELDS;
};
DECLARE_QOBJ_TYPE(bgp);