diff options
author | Maria Matejka <mq@ucw.cz> | 2022-08-02 22:08:59 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2022-08-02 22:08:59 +0200 |
commit | 71b434a987067475b517792360f58dbe03bfee9e (patch) | |
tree | a6bad599a80fd6dd16b0117f16e95a5c213cfe8d /nest/rt-table.c | |
parent | 0072d11f3431165240656edf6ade473554b8747e (diff) | |
parent | f0507f05ce57398e135651896dace4cb68eeed54 (diff) |
Merge commit 'f0507f05ce57398e135651896dace4cb68eeed54' into thread-next
Diffstat (limited to 'nest/rt-table.c')
-rw-r--r-- | nest/rt-table.c | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/nest/rt-table.c b/nest/rt-table.c index 15dbc371..b8f0e61d 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -673,16 +673,16 @@ rte_better(rte *new, rte *old) return 1; if (np < op) return 0; - if (new->src->proto->proto != old->src->proto->proto) + if (new->src->owner->class != old->src->owner->class) { /* * If the user has configured protocol preferences, so that two different protocols * have the same preference, try to break the tie by comparing addresses. Not too * useful, but keeps the ordering of routes unambiguous. */ - return new->src->proto->proto > old->src->proto->proto; + return new->src->owner->class > old->src->owner->class; } - if (better = new->src->proto->rte_better) + if (better = new->src->owner->class->rte_better) return better(new, old); return 0; } @@ -698,10 +698,10 @@ rte_mergable(rte *pri, rte *sec) if (rt_get_preference(pri) != rt_get_preference(sec)) return 0; - if (pri->src->proto->proto != sec->src->proto->proto) + if (pri->src->owner->class != sec->src->owner->class) return 0; - if (mergable = pri->src->proto->rte_mergable) + if (mergable = pri->src->owner->class->rte_mergable) return mergable(pri, sec); return 0; @@ -1596,10 +1596,10 @@ rte_recalculate(struct rt_import_hook *c, net *net, rte *new, struct rte_src *sr { if (!old->generation && !new->generation) bug("Two protocols claim to author a route with the same rte_src in table %s: %N %s/%u:%u", - c->table->name, net->n.addr, old->src->proto->name, old->src->private_id, old->src->global_id); + c->table->name, net->n.addr, old->src->owner->name, old->src->private_id, old->src->global_id); log_rl(&table->rl_pipe, L_ERR "Route source collision in table %s: %N %s/%u:%u", - c->table->name, net->n.addr, old->src->proto->name, old->src->private_id, old->src->global_id); + c->table->name, net->n.addr, old->src->owner->name, old->src->private_id, old->src->global_id); } if (new && rte_same(old, &new_stored->rte)) @@ -1675,8 +1675,8 @@ rte_recalculate(struct rt_import_hook *c, net *net, rte *new, struct rte_src *sr /* If routes are not sorted, find the best route and move it on the first position. There are several optimized cases. */ - if (src->proto->rte_recalculate && - src->proto->rte_recalculate(table, net, new_stored ? &new_stored->rte : NULL, old, old_best)) + if (src->owner->rte_recalculate && + src->owner->rte_recalculate(table, net, new_stored ? &new_stored->rte : NULL, old, old_best)) goto do_recalculate; if (new_stored && rte_better(&new_stored->rte, old_best)) @@ -2876,8 +2876,6 @@ again: } } - rt_prune_sources(); - uint flushed_channels = 0; /* Close flushed channels */ @@ -3048,7 +3046,6 @@ rt_export_cleanup(rtable *tab) done:; struct rt_import_hook *ih; node *x; - _Bool imports_stopped = 0; WALK_LIST2_DELSAFE(ih, n, x, tab->imports, n) if (ih->import_state == TIS_WAITING) if (!first || (first->seq >= ih->flush_seq)) @@ -3058,19 +3055,11 @@ done:; rem_node(&ih->n); mb_free(ih); rt_unlock_table(tab); - imports_stopped = 1; } if (tab->export_used) ev_schedule(tab->rt_event); - if (imports_stopped) - { - if (config->table_debug) - log(L_TRACE "%s: Sources pruning routine requested", tab->name); - - rt_prune_sources(); - } if (EMPTY_LIST(tab->exporter.pending) && tm_active(tab->exporter.export_timer)) tm_stop(tab->exporter.export_timer); @@ -3554,8 +3543,8 @@ rt_next_hop_update_net(rtable *tab, net *n) /* Call a pre-comparison hook */ /* Not really an efficient way to compute this */ - if (e->rte.src->proto->rte_recalculate) - e->rte.src->proto->rte_recalculate(tab, n, &new->rte, &e->rte, &old_best->rte); + if (e->rte.src->owner->rte_recalculate) + e->rte.src->owner->rte_recalculate(tab, n, &new->rte, &e->rte, &old_best->rte); updates[pos++] = (struct rte_multiupdate) { .old = e, @@ -4170,8 +4159,8 @@ rt_get_igp_metric(const rte *rt) if (rt_get_source_attr(rt) == RTS_DEVICE) return 0; - if (rt->src->proto->rte_igp_metric) - return rt->src->proto->rte_igp_metric(rt); + if (rt->src->owner->class->rte_igp_metric) + return rt->src->owner->class->rte_igp_metric(rt); return IGP_METRIC_UNKNOWN; } |