mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 22:57:45 +00:00
If a route-map is used on a neighbor default-originate statement we need to dynamically add/del the default route if the permit/deny result of the route-map changes.
This commit is contained in:
parent
078430f609
commit
0de4848df6
@ -2556,7 +2556,17 @@ bgp_process_main (struct work_queue *wq, void *data)
|
|||||||
|
|
||||||
/* bestpath has changed; bump version */
|
/* bestpath has changed; bump version */
|
||||||
if (old_select || new_select)
|
if (old_select || new_select)
|
||||||
bgp_bump_version(rn);
|
{
|
||||||
|
bgp_bump_version(rn);
|
||||||
|
|
||||||
|
if (!bgp->t_rmap_def_originate_eval)
|
||||||
|
{
|
||||||
|
bgp_lock (bgp);
|
||||||
|
THREAD_TIMER_ON(master, bgp->t_rmap_def_originate_eval,
|
||||||
|
update_group_refresh_default_originate_route_map,
|
||||||
|
bgp, RMAP_DEFAULT_ORIGINATE_EVAL_TIMER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (old_select)
|
if (old_select)
|
||||||
bgp_info_unset_flag (rn, old_select, BGP_INFO_SELECTED);
|
bgp_info_unset_flag (rn, old_select, BGP_INFO_SELECTED);
|
||||||
|
@ -1739,7 +1739,9 @@ update_group_af_walk (struct bgp *bgp, afi_t afi, safi_t safi,
|
|||||||
memset (&wctx, 0, sizeof (wctx));
|
memset (&wctx, 0, sizeof (wctx));
|
||||||
wctx.cb = cb;
|
wctx.cb = cb;
|
||||||
wctx.context = ctx;
|
wctx.context = ctx;
|
||||||
hash_walk (bgp->update_groups[afid], update_group_walkcb, &wctx);
|
|
||||||
|
if (bgp->update_groups[afid])
|
||||||
|
hash_walk (bgp->update_groups[afid], update_group_walkcb, &wctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1763,6 +1765,44 @@ update_group_periodic_merge (struct bgp *bgp)
|
|||||||
(void *) reason);
|
(void *) reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
update_group_default_originate_route_map_walkcb(struct update_group *updgrp,
|
||||||
|
void *arg)
|
||||||
|
{
|
||||||
|
struct update_subgroup *subgrp;
|
||||||
|
struct peer *peer;
|
||||||
|
struct peer_af *paf;
|
||||||
|
afi_t afi;
|
||||||
|
safi_t safi;
|
||||||
|
|
||||||
|
UPDGRP_FOREACH_SUBGRP (updgrp, subgrp)
|
||||||
|
{
|
||||||
|
peer = SUBGRP_PEER (subgrp);
|
||||||
|
afi = SUBGRP_AFI (subgrp);
|
||||||
|
safi = SUBGRP_SAFI (subgrp);
|
||||||
|
|
||||||
|
if (peer->default_rmap[afi][safi].name)
|
||||||
|
{
|
||||||
|
subgroup_default_originate (subgrp, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return UPDWALK_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
update_group_refresh_default_originate_route_map (struct thread *thread)
|
||||||
|
{
|
||||||
|
struct bgp *bgp;
|
||||||
|
char reason[] = "refresh default-originate route-map";
|
||||||
|
|
||||||
|
bgp = THREAD_ARG(thread);
|
||||||
|
update_group_walk (bgp, update_group_default_originate_route_map_walkcb,
|
||||||
|
reason);
|
||||||
|
THREAD_TIMER_OFF (bgp->t_rmap_def_originate_eval);
|
||||||
|
bgp_unlock(bgp);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* peer_af_announce_route
|
* peer_af_announce_route
|
||||||
*
|
*
|
||||||
|
@ -377,6 +377,7 @@ extern void update_group_af_walk (struct bgp *bgp, afi_t afi, safi_t safi,
|
|||||||
updgrp_walkcb cb, void *ctx);
|
updgrp_walkcb cb, void *ctx);
|
||||||
extern void update_group_walk (struct bgp *bgp, updgrp_walkcb cb, void *ctx);
|
extern void update_group_walk (struct bgp *bgp, updgrp_walkcb cb, void *ctx);
|
||||||
extern void update_group_periodic_merge (struct bgp *bgp);
|
extern void update_group_periodic_merge (struct bgp *bgp);
|
||||||
|
extern void update_group_refresh_default_originate_route_map (struct thread *thread);
|
||||||
extern void update_group_start_advtimer (struct bgp *bgp);
|
extern void update_group_start_advtimer (struct bgp *bgp);
|
||||||
|
|
||||||
extern void update_subgroup_inherit_info (struct update_subgroup *to,
|
extern void update_subgroup_inherit_info (struct update_subgroup *to,
|
||||||
|
@ -2612,6 +2612,7 @@ bgp_get (struct bgp **bgp_val, as_t *as, const char *name)
|
|||||||
bgp_router_id_set(bgp, &router_id_zebra);
|
bgp_router_id_set(bgp, &router_id_zebra);
|
||||||
*bgp_val = bgp;
|
*bgp_val = bgp;
|
||||||
|
|
||||||
|
bgp->t_rmap_def_originate_eval = NULL;
|
||||||
bgp->t_rmap_update = NULL;
|
bgp->t_rmap_update = NULL;
|
||||||
bgp->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER;
|
bgp->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER;
|
||||||
|
|
||||||
@ -2694,6 +2695,12 @@ bgp_delete (struct bgp *bgp)
|
|||||||
peer_delete(bgp->peer_self);
|
peer_delete(bgp->peer_self);
|
||||||
bgp->peer_self = NULL;
|
bgp->peer_self = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bgp->t_rmap_def_originate_eval)
|
||||||
|
{
|
||||||
|
BGP_TIMER_OFF(bgp->t_rmap_def_originate_eval);
|
||||||
|
bgp_unlock(bgp);
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove visibility via the master list - there may however still be
|
/* Remove visibility via the master list - there may however still be
|
||||||
* routes to be processed still referencing the struct bgp.
|
* routes to be processed still referencing the struct bgp.
|
||||||
|
@ -266,6 +266,10 @@ struct bgp
|
|||||||
u_int32_t rmap_update_timer; /* Route map update timer */
|
u_int32_t rmap_update_timer; /* Route map update timer */
|
||||||
#define RMAP_DEFAULT_UPDATE_TIMER 5 /* disabled by default */
|
#define RMAP_DEFAULT_UPDATE_TIMER 5 /* disabled by default */
|
||||||
|
|
||||||
|
/* timer to re-evaluate neighbor default-originate route-maps */
|
||||||
|
struct thread *t_rmap_def_originate_eval;
|
||||||
|
#define RMAP_DEFAULT_ORIGINATE_EVAL_TIMER 5
|
||||||
|
|
||||||
/* BGP distance configuration. */
|
/* BGP distance configuration. */
|
||||||
u_char distance_ebgp;
|
u_char distance_ebgp;
|
||||||
u_char distance_ibgp;
|
u_char distance_ibgp;
|
||||||
|
Loading…
Reference in New Issue
Block a user