/* bestpath has changed; bump version */
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)
bgp_info_unset_flag (rn, old_select, BGP_INFO_SELECTED);
memset (&wctx, 0, sizeof (wctx));
wctx.cb = cb;
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 *) 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
*
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_refresh_default_originate_route_map (struct thread *thread);
extern void update_group_start_advtimer (struct bgp *bgp);
extern void update_subgroup_inherit_info (struct update_subgroup *to,
bgp_router_id_set(bgp, &router_id_zebra);
*bgp_val = bgp;
+ bgp->t_rmap_def_originate_eval = NULL;
bgp->t_rmap_update = NULL;
bgp->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER;
peer_delete(bgp->peer_self);
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
* routes to be processed still referencing the struct bgp.
u_int32_t rmap_update_timer; /* Route map update timer */
#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. */
u_char distance_ebgp;
u_char distance_ibgp;