From: Donald Sharp Date: Mon, 14 Feb 2022 12:57:45 +0000 (-0500) Subject: bgp: Add a 15 minute warning to missing policy X-Git-Tag: docker/8.2.0~20^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F10607%2Fhead;p=mirror%2Ffrr.git 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 (cherry picked from commit b17826b715996558df93ae52e281c10c8925fdce) --- diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 4864089f8a..50c147c5c4 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -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; } diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index e6d4000ad8..567b049c1b 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -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; } diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index ae6427b356..ff295ffa27 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -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);