diff options
author | David Lamparter <equinox@diac24.net> | 2010-02-05 01:40:40 +0100 |
---|---|---|
committer | David Lamparter <equinox@diac24.net> | 2010-02-05 01:40:40 +0100 |
commit | f06277c84f7604b380bdac491e23c848d4952d18 (patch) | |
tree | 41a46707f2780d48893140e42ca3988fc761242f /zebra | |
parent | 447a9a8dbde95fc6ce92691491ac193f0199e2cd (diff) | |
parent | 590f04362a6dd546e868b5160a72443ce97547ca (diff) | |
download | quagga-f06277c84f7604b380bdac491e23c848d4952d18.tar.bz2 quagga-f06277c84f7604b380bdac491e23c848d4952d18.tar.xz |
Merge branch 'patches/smallones' into dn42
Diffstat (limited to 'zebra')
-rw-r--r-- | zebra/rib.h | 1 | ||||
-rw-r--r-- | zebra/zebra_rib.c | 43 | ||||
-rw-r--r-- | zebra/zserv.c | 8 | ||||
-rw-r--r-- | zebra/zserv.h | 3 |
4 files changed, 44 insertions, 11 deletions
diff --git a/zebra/rib.h b/zebra/rib.h index 887ed3c2..499d48b2 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -262,6 +262,7 @@ extern struct rib *rib_match_ipv4 (struct in_addr); extern struct rib *rib_lookup_ipv4 (struct prefix_ipv4 *); extern void rib_update (void); +extern void rib_update_background (void); extern void rib_weed_tables (void); extern void rib_sweep_route (void); extern void rib_close (void); diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 29a8e40b..6ac43d8c 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -1424,7 +1424,6 @@ rib_queue_init (struct zebra_t *zebra) zebra->ribq->spec.errorfunc = NULL; /* XXX: TODO: These should be runtime configurable via vty */ zebra->ribq->spec.max_retries = 3; - zebra->ribq->spec.hold = rib_process_hold_time; if (!(zebra->mq = meta_queue_new ())) zlog_err ("%s: could not initialise meta queue!", __func__); @@ -2886,23 +2885,45 @@ static_delete_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate, #endif /* HAVE_IPV6 */ /* RIB update function. */ -void -rib_update (void) +static void +rib_update_table (struct table *table) { struct route_node *rn; - struct route_table *table; - - table = vrf_table (AFI_IP, SAFI_UNICAST, 0); if (table) for (rn = route_top (table); rn; rn = route_next (rn)) if (rn->info) rib_queue_add (&zebrad, rn); +} - table = vrf_table (AFI_IP6, SAFI_UNICAST, 0); - if (table) - for (rn = route_top (table); rn; rn = route_next (rn)) - if (rn->info) - rib_queue_add (&zebrad, rn); +void +rib_update (void) +{ + if (zebrad.update) + { + thread_cancel (zebrad.update); + zebrad.update = NULL; + } + + rib_update_table (vrf_table (AFI_IP, SAFI_UNICAST, 0)); + +#ifdef HAVE_IPV6 + rib_update_table (vrf_table (AFI_IP6, SAFI_UNICAST, 0)); +#endif +} + +static int +rib_update_thread (struct thread *self) +{ + rib_update (); + return 0; +} + +void +rib_update_background (void) +{ + if (!zebrad.update) + zebrad.update = thread_add_background (zebrad.master, rib_update_thread, + NULL, rib_process_hold_time); } diff --git a/zebra/zserv.c b/zebra/zserv.c index 21f24627..ced8fa5a 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -877,6 +877,8 @@ zread_ipv4_add (struct zserv *client, u_short length) /* Table */ rib->table=zebrad.rtm_table_default; rib_add_ipv4_multipath (&p, rib); + + rib_update_background (); return 0; } @@ -951,6 +953,8 @@ zread_ipv4_delete (struct zserv *client, u_short length) rib_delete_ipv4 (api.type, api.flags, &p, &nexthop, ifindex, client->rtm_table); + + rib_update_background (); return 0; } @@ -1052,6 +1056,8 @@ zread_ipv6_add (struct zserv *client, u_short length) else rib_add_ipv6 (api.type, api.flags, &p, &nexthop, ifindex, zebrad.rtm_table_default, api.metric, api.distance); + + rib_update_background (); return 0; } @@ -1116,6 +1122,8 @@ zread_ipv6_delete (struct zserv *client, u_short length) rib_delete_ipv6 (api.type, api.flags, &p, NULL, ifindex, client->rtm_table); else rib_delete_ipv6 (api.type, api.flags, &p, &nexthop, ifindex, client->rtm_table); + + rib_update_background (); return 0; } diff --git a/zebra/zserv.h b/zebra/zserv.h index cccd9be0..340e7f5d 100644 --- a/zebra/zserv.h +++ b/zebra/zserv.h @@ -83,6 +83,9 @@ struct zebra_t /* rib work queue */ struct work_queue *ribq; struct meta_queue *mq; + + /* rib update thread */ + struct thread *update; }; /* Count prefix size from mask length */ |