* called for each route-map and within this function we walk the list of peers,
* network statements, etc looking to see if they use this route-map.
*/
-static int
-bgp_route_map_process_update (void *arg, const char *rmap_name, int route_update)
+static void
+bgp_route_map_process_update (struct bgp *bgp, const char *rmap_name, int route_update)
{
int i;
afi_t afi;
struct peer *peer;
struct bgp_node *bn;
struct bgp_static *bgp_static;
- struct bgp *bgp = (struct bgp *)arg;
struct listnode *node, *nnode;
struct route_map *map;
char buf[INET6_ADDRSTRLEN];
- if (!bgp)
- return (-1);
-
map = route_map_lookup_by_name (rmap_name);
for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
}
}
}
-
- return (0);
}
static int
-bgp_route_map_process_update_cb (void *arg, char *rmap_name)
+bgp_route_map_process_update_cb (char *rmap_name)
{
- return bgp_route_map_process_update (arg, rmap_name, 1);
+ struct listnode *node, *nnode;
+ struct bgp *bgp;
+
+ for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
+ bgp_route_map_process_update(bgp, rmap_name, 1);
+
+ return 0;
}
int
bgp_route_map_update_timer(struct thread *thread)
{
- struct bgp *bgp = THREAD_ARG(thread);
+ bm->t_rmap_update = NULL;
- bgp->t_rmap_update = NULL;
-
- route_map_walk_update_list((void *)bgp, bgp_route_map_process_update_cb);
+ route_map_walk_update_list(bgp_route_map_process_update_cb);
return (0);
}
static void
bgp_route_map_mark_update (const char *rmap_name)
{
- struct listnode *node, *nnode;
- struct bgp *bgp;
-
- for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
+ if (bm->t_rmap_update == NULL)
{
+ struct listnode *node, *nnode;
+ struct bgp *bgp;
- if (bgp->t_rmap_update == NULL)
- {
- /* rmap_update_timer of 0 means don't do route updates */
- if (bgp->rmap_update_timer)
- {
- bgp->t_rmap_update =
- thread_add_timer(bm->master, bgp_route_map_update_timer, bgp,
- bgp->rmap_update_timer);
- /* Signal the groups that a route-map update event has started */
- update_group_policy_update(bgp, BGP_POLICY_ROUTE_MAP, rmap_name, 1, 1);
- }
- else
- bgp_route_map_process_update((void *)bgp, rmap_name, 0);
- }
+ /* rmap_update_timer of 0 means don't do route updates */
+ if (bm->rmap_update_timer)
+ {
+ bm->t_rmap_update =
+ thread_add_timer(bm->master, bgp_route_map_update_timer, NULL,
+ bm->rmap_update_timer);
+
+ /* Signal the groups that a route-map update event has started */
+ for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
+ update_group_policy_update(bgp, BGP_POLICY_ROUTE_MAP, rmap_name, 1, 1);
+ }
+ else
+ {
+ for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
+ bgp_route_map_process_update(bgp, rmap_name, 0);
+ }
}
}
"0 disables the timer, no route updates happen when route-maps change\n")
{
u_int32_t rmap_delay_timer;
- struct bgp *bgp;
- bgp = vty->index;
if (argv[0])
{
VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[0], 0, 600);
- bgp->rmap_update_timer = rmap_delay_timer;
+ bm->rmap_update_timer = rmap_delay_timer;
/* if the dynamic update handling is being disabled, and a timer is
* running, stop the timer and act as if the timer has already fired.
*/
- if (!rmap_delay_timer && bgp->t_rmap_update )
+ if (!rmap_delay_timer && bm->t_rmap_update )
{
- BGP_TIMER_OFF(bgp->t_rmap_update);
- thread_execute (bm->master, bgp_route_map_update_timer, &bgp, 0);
+ BGP_TIMER_OFF(bm->t_rmap_update);
+ thread_execute (bm->master, bgp_route_map_update_timer, NULL, 0);
}
return CMD_SUCCESS;
}
"Default BGP route-map delay timer\n"
"Reset to default time to wait for processing route-map changes\n")
{
- struct bgp *bgp;
- bgp = vty->index;
- bgp->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER;
+ bm->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER;
return CMD_SUCCESS;
}
install_element (CONFIG_NODE, &bgp_config_type_cmd);
install_element (CONFIG_NODE, &no_bgp_config_type_val_cmd);
+ /* bgp route-map delay-timer commands. */
+ install_element (CONFIG_NODE, &bgp_set_route_map_delay_timer_cmd);
+ install_element (CONFIG_NODE, &no_bgp_set_route_map_delay_timer_cmd);
+ install_element (CONFIG_NODE, &no_bgp_set_route_map_delay_timer_val_cmd);
+
/* Dummy commands (Currently not supported) */
install_element (BGP_NODE, &no_synchronization_cmd);
install_element (BGP_NODE, &no_auto_summary_cmd);
install_element (BGP_NODE, &no_bgp_timers_cmd);
install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
- /* route-map delay-timer commands */
+ /* route-map delay-timer commands - per instance for backwards compat. */
install_element (BGP_NODE, &bgp_set_route_map_delay_timer_cmd);
install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_cmd);
install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_val_cmd);
*bgp_val = bgp;
bgp->t_rmap_def_originate_eval = NULL;
- bgp->t_rmap_update = NULL;
- bgp->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER;
/* Create BGP server socket, if first instance. */
if (list_isempty(bm->bgp)
struct listnode *next;
/* Stop timers. */
- if (bgp->t_rmap_update)
- BGP_TIMER_OFF(bgp->t_rmap_update);
if (bgp->t_rmap_def_originate_eval)
{
BGP_TIMER_OFF(bgp->t_rmap_def_originate_eval);
}
/* Stop timers. */
- if (bgp->t_rmap_update)
- BGP_TIMER_OFF(bgp->t_rmap_update);
if (bgp->t_rmap_def_originate_eval)
{
BGP_TIMER_OFF(bgp->t_rmap_def_originate_eval);
write++;
}
+ if (bm->rmap_update_timer != RMAP_DEFAULT_UPDATE_TIMER)
+ vty_out (vty, "bgp route-map delay-timer %d%s", bm->rmap_update_timer,
+ VTY_NEWLINE);
+
/* BGP configuration. */
for (ALL_LIST_ELEMENTS (bm->bgp, mnode, mnnode, bgp))
{
vty_out (vty, " timers bgp %d %d%s", bgp->default_keepalive,
bgp->default_holdtime, VTY_NEWLINE);
- if (bgp->rmap_update_timer != RMAP_DEFAULT_UPDATE_TIMER)
- vty_out (vty, " bgp route-map delay-timer %d%s", bgp->rmap_update_timer,
- VTY_NEWLINE);
-
/* peer-group */
for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group))
{
bm->port = BGP_PORT_DEFAULT;
bm->master = thread_master_create ();
bm->start_time = bgp_clock ();
+ bm->t_rmap_update = NULL;
+ bm->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER;
bgp_process_queue_init();
}
work_queue_free (bm->process_main_queue);
bm->process_main_queue = NULL;
}
+
+ if (bm->t_rmap_update)
+ BGP_TIMER_OFF(bm->t_rmap_update);
}
u_int64_t updgrp_idspace;
u_int64_t subgrp_idspace;
+
+ /* timer to dampen route map changes */
+ struct thread *t_rmap_update; /* Handle route map updates */
+ u_int32_t rmap_update_timer; /* Route map update timer */
+#define RMAP_DEFAULT_UPDATE_TIMER 5 /* disabled by default */
};
/* BGP route-map structure. */
/* BGP redistribute configuration. */
struct list *redist[AFI_MAX][ZEBRA_ROUTE_MAX];
- /* timer to dampen route map changes */
- struct thread *t_rmap_update; /* Handle route map updates */
- 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
}
void
-route_map_walk_update_list (void *arg,
- int (*route_map_update_fn) (void *arg, char *name))
+route_map_walk_update_list (int (*route_map_update_fn) (char *name))
{
struct route_map *node;
struct route_map *nnode = NULL;
if (node->to_be_processed)
{
/* DD: Should we add any thread yield code here */
- route_map_update_fn(arg, node->name);
+ route_map_update_fn(node->name);
nnode = node->next;
route_map_clear_updated(node);
}
const char *));
extern int route_map_mark_updated (const char *name, int deleted);
extern int route_map_clear_updated (struct route_map *rmap);
-extern void route_map_walk_update_list (void *arg,
- int (*update_fn) (void *arg,
- char *name));
+extern void route_map_walk_update_list (int (*update_fn) (char *name));
extern void route_map_upd8_dependency (route_map_event_t type, const char *arg,
const char *rmap_name);
extern void route_map_notify_dependencies (const char *affected_name,