summaryrefslogtreecommitdiff
path: root/proto/mrt
diff options
context:
space:
mode:
Diffstat (limited to 'proto/mrt')
-rw-r--r--proto/mrt/mrt.c59
-rw-r--r--proto/mrt/mrt.h6
2 files changed, 15 insertions, 50 deletions
diff --git a/proto/mrt/mrt.c b/proto/mrt/mrt.c
index b40592d2..9d78438d 100644
--- a/proto/mrt/mrt.c
+++ b/proto/mrt/mrt.c
@@ -228,7 +228,7 @@ mrt_next_table_(rtable *tab, rtable *tab_ptr, const char *pattern)
NODE_VALID(tn);
tn = tn->next)
{
- tab = SKIP_BACK(rtable, n, tn);
+ tab = SKIP_BACK(struct rtable, n, tn);
if (patmatch(pattern, tab->name) &&
((tab->addr_type == NET_IP4) || (tab->addr_type == NET_IP6)))
return tab;
@@ -243,21 +243,13 @@ mrt_next_table(struct mrt_table_dump_state *s)
rtable *tab = mrt_next_table_(s->table, s->table_ptr, s->table_expr);
if (s->table)
- {
- RT_LOCK(s->table);
- rt_unlock_table(RT_PRIV(s->table));
- RT_UNLOCK(s->table);
- }
+ rt_unlock_table(s->table);
s->table = tab;
s->ipv4 = tab ? (tab->addr_type == NET_IP4) : 0;
if (s->table)
- {
- RT_LOCK(s->table);
- rt_lock_table(RT_PRIV(s->table));
- RT_UNLOCK(s->table);
- }
+ rt_lock_table(s->table);
return s->table;
}
@@ -581,23 +573,14 @@ mrt_table_dump_init(pool *pp)
static void
mrt_table_dump_free(struct mrt_table_dump_state *s)
{
- if (s->table)
- {
- RT_LOCK(s->table);
-
- if (s->table_open)
- FIB_ITERATE_UNLINK(&s->fit, &RT_PRIV(s->table)->fib);
+ if (s->table_open)
+ FIB_ITERATE_UNLINK(&s->fit, &s->table->fib);
- rt_unlock_table(RT_PRIV(s->table));
- RT_UNLOCK(s->table);
- }
+ if (s->table)
+ rt_unlock_table(s->table);
if (s->table_ptr)
- {
- RT_LOCK(s->table_ptr);
- rt_unlock_table(RT_PRIV(s->table_ptr));
- RT_UNLOCK(s->table_ptr);
- }
+ rt_unlock_table(s->table_ptr);
config_del_obstacle(s->config);
@@ -613,14 +596,8 @@ mrt_table_dump_step(struct mrt_table_dump_state *s)
s->max = 2048;
s->bws = &bws;
- rtable_private *tab;
-
if (s->table_open)
- {
- RT_LOCK(s->table);
- tab = RT_PRIV(s->table);
goto step;
- }
while (mrt_next_table(s))
{
@@ -629,18 +606,15 @@ mrt_table_dump_step(struct mrt_table_dump_state *s)
mrt_peer_table_dump(s);
- RT_LOCK(s->table);
- tab = RT_PRIV(s->table);
- FIB_ITERATE_INIT(&s->fit, &tab->fib);
+ FIB_ITERATE_INIT(&s->fit, &s->table->fib);
s->table_open = 1;
step:
- FIB_ITERATE_START(&tab->fib, &s->fit, net, n)
+ FIB_ITERATE_START(&s->table->fib, &s->fit, net, n)
{
if (s->max < 0)
{
FIB_ITERATE_PUT(&s->fit);
- RT_UNLOCK(s->table);
return 0;
}
@@ -660,7 +634,6 @@ mrt_table_dump_step(struct mrt_table_dump_state *s)
mrt_peer_table_flush(s);
}
- RT_UNLOCK(s->table);
return 1;
}
@@ -688,11 +661,7 @@ mrt_timer(timer *t)
s->always_add_path = cf->always_add_path;
if (s->table_ptr)
- {
- RT_LOCK(s->table_ptr);
- rt_lock_table(RT_PRIV(s->table_ptr));
- RT_UNLOCK(s->table_ptr);
- }
+ rt_lock_table(s->table_ptr);
p->table_dump = s;
ev_schedule(p->event);
@@ -765,11 +734,7 @@ mrt_dump_cmd(struct mrt_dump_data *d)
s->filename = d->filename;
if (s->table_ptr)
- {
- RT_LOCK(s->table_ptr);
- rt_lock_table(RT_PRIV(s->table_ptr));
- RT_UNLOCK(s->table_ptr);
- }
+ rt_lock_table(s->table_ptr);
this_cli->cont = mrt_dump_cont;
this_cli->cleanup = mrt_dump_cleanup;
diff --git a/proto/mrt/mrt.h b/proto/mrt/mrt.h
index 04865089..4ff94c12 100644
--- a/proto/mrt/mrt.h
+++ b/proto/mrt/mrt.h
@@ -40,7 +40,7 @@ struct mrt_proto {
struct mrt_dump_data {
const char *table_expr;
- rtable *table_ptr;
+ struct rtable *table_ptr;
const struct filter *filter;
const char *filename;
};
@@ -60,7 +60,7 @@ struct mrt_table_dump_state {
/* Configuration information */
const char *table_expr; /* Wildcard for table name (or NULL) */
- rtable *table_ptr; /* Explicit table (or NULL) */
+ struct rtable *table_ptr; /* Explicit table (or NULL) */
const struct filter *filter; /* Optional filter */
const char *filename; /* Filename pattern */
int always_add_path; /* Always use *_ADDPATH message subtypes */
@@ -73,7 +73,7 @@ struct mrt_table_dump_state {
HASH(struct mrt_peer_entry) peer_hash; /* Hash for peers to find the index */
- rtable *table; /* Processed table, NULL initially */
+ struct rtable *table; /* Processed table, NULL initially */
struct fib_iterator fit; /* Iterator in processed table */
int table_open; /* Whether iterator is linked */