Changes 'rejected' to 'filtered' in one of the last patches.
This commit is contained in:
parent
e16469bc4d
commit
1555095795
7 changed files with 38 additions and 38 deletions
|
@ -459,12 +459,12 @@ to zero to disable it. An empty <cf><m/switch/</cf> is equivalent to <cf/on/
|
|||
works in the direction from the routing table to the protocol.
|
||||
Default: <cf/none/.
|
||||
|
||||
<tag>import keep rejected <m/bool/</tag>
|
||||
<tag>import keep filtered <m/bool/</tag>
|
||||
Usually, if an import filter rejects a route, the route is
|
||||
forgotten. When this option is active, rejected routes are
|
||||
forgotten. When this option is active, these routes are
|
||||
kept in the routing table, but they are hidden and not
|
||||
propagated to other protocols. But it is possible to show them
|
||||
using <cf/show route rejected/. Note that this option does not
|
||||
using <cf/show route filtered/. Note that this option does not
|
||||
work for the pipe protocol. Default: off.
|
||||
|
||||
<tag>import limit <m/number/ [action warn | block | restart | disable]</tag>
|
||||
|
@ -476,7 +476,7 @@ to zero to disable it. An empty <cf><m/switch/</cf> is equivalent to <cf/on/
|
|||
like appropriate commands. Disable is the default action if an
|
||||
action is not explicitly specified. Note that limits are reset
|
||||
during protocol reconfigure, reload or restart. Also note that
|
||||
if <cf/import keep rejected/ is active, rejected routes are
|
||||
if <cf/import keep filtered/ is active, filtered routes are
|
||||
counted towards the limit and blocked routes are forgotten, as
|
||||
the main purpose of the import limit is to protect routing
|
||||
tables from overflow. Default: <cf/none/.
|
||||
|
@ -672,8 +672,8 @@ This argument can be omitted if there exists only a single instance.
|
|||
<p>You can also select just routes added by a specific protocol.
|
||||
<cf>protocol <m/p/</cf>.
|
||||
|
||||
<p>If BIRD is configured to keep rejected routes (see </cf/import keep rejected/
|
||||
option), you can show them instead of routes by using </cf/rejected/ switch.
|
||||
<p>If BIRD is configured to keep filtered routes (see </cf/import keep filtered/
|
||||
option), you can show them instead of routes by using </cf/filtered/ switch.
|
||||
|
||||
<p>The <cf/stats/ switch requests showing of route statistics (the
|
||||
number of networks, number of routes before and after filtering). If
|
||||
|
|
|
@ -44,7 +44,7 @@ CF_DECLS
|
|||
|
||||
CF_KEYWORDS(ROUTER, ID, PROTOCOL, TEMPLATE, PREFERENCE, DISABLED, DEBUG, ALL, OFF, DIRECT)
|
||||
CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE, TABLE, STATES, ROUTES, FILTERS)
|
||||
CF_KEYWORDS(LIMIT, ACTION, WARN, BLOCK, RESTART, DISABLE, KEEP, REJECTED)
|
||||
CF_KEYWORDS(LIMIT, ACTION, WARN, BLOCK, RESTART, DISABLE, KEEP, FILTERED)
|
||||
CF_KEYWORDS(PASSWORD, FROM, PASSIVE, TO, ID, EVENTS, PACKETS, PROTOCOLS, INTERFACES)
|
||||
CF_KEYWORDS(PRIMARY, STATS, COUNT, FOR, COMMANDS, PREEXPORT, GENERATE, ROA, MAX, FLUSH)
|
||||
CF_KEYWORDS(LISTEN, BGP, V6ONLY, DUAL, ADDRESS, PORT, PASSWORDS, DESCRIPTION, SORTED)
|
||||
|
@ -187,7 +187,7 @@ proto_item:
|
|||
| EXPORT imexport { this_proto->out_filter = $2; }
|
||||
| IMPORT LIMIT limit_spec { this_proto->in_limit = $3; }
|
||||
| EXPORT LIMIT limit_spec { this_proto->out_limit = $3; }
|
||||
| IMPORT KEEP REJECTED bool { this_proto->in_keep_rejected = $4; }
|
||||
| IMPORT KEEP FILTERED bool { this_proto->in_keep_filtered = $4; }
|
||||
| TABLE rtable { this_proto->table = $2; }
|
||||
| ROUTER ID idval { this_proto->router_id = $3; }
|
||||
| DESCRIPTION TEXT { this_proto->dsc = $2; }
|
||||
|
@ -406,7 +406,7 @@ CF_CLI(SHOW INTERFACES SUMMARY,,, [[Show summary of network interfaces]])
|
|||
{ if_show_summary(); } ;
|
||||
|
||||
CF_CLI_HELP(SHOW ROUTE, ..., [[Show routing table]])
|
||||
CF_CLI(SHOW ROUTE, r_args, [[[<prefix>|for <prefix>|for <ip>] [table <t>] [filter <f>|where <cond>] [all] [primary] [rejected] [(export|preexport) <p>] [protocol <p>] [stats|count]]], [[Show routing table]])
|
||||
CF_CLI(SHOW ROUTE, r_args, [[[<prefix>|for <prefix>|for <ip>] [table <t>] [filter <f>|where <cond>] [all] [primary] [filtered] [(export|preexport) <p>] [protocol <p>] [stats|count]]], [[Show routing table]])
|
||||
{ rt_show($3); } ;
|
||||
|
||||
r_args:
|
||||
|
@ -452,9 +452,9 @@ r_args:
|
|||
$$ = $1;
|
||||
$$->primary_only = 1;
|
||||
}
|
||||
| r_args REJECTED {
|
||||
| r_args FILTERED {
|
||||
$$ = $1;
|
||||
$$->rejected = 1;
|
||||
$$->filtered = 1;
|
||||
}
|
||||
| r_args export_or_preexport SYM {
|
||||
struct proto_config *c = (struct proto_config *) $3->def;
|
||||
|
|
16
nest/proto.c
16
nest/proto.c
|
@ -414,7 +414,7 @@ proto_reconfigure(struct proto *p, struct proto_config *oc, struct proto_config
|
|||
p->main_ahook->out_filter = nc->out_filter;
|
||||
p->main_ahook->in_limit = nc->in_limit;
|
||||
p->main_ahook->out_limit = nc->out_limit;
|
||||
p->main_ahook->in_keep_rejected = nc->in_keep_rejected;
|
||||
p->main_ahook->in_keep_filtered = nc->in_keep_filtered;
|
||||
}
|
||||
|
||||
/* Update routes when filters changed. If the protocol in not UP,
|
||||
|
@ -720,7 +720,7 @@ proto_fell_down(struct proto *p)
|
|||
{
|
||||
DBG("Protocol %s down\n", p->name);
|
||||
|
||||
u32 all_routes = p->stats.imp_routes + p->stats.rej_routes;
|
||||
u32 all_routes = p->stats.imp_routes + p->stats.filt_routes;
|
||||
if (all_routes != 0)
|
||||
log(L_ERR "Protocol %s is down but still has %d routes", p->name, all_routes);
|
||||
|
||||
|
@ -798,7 +798,7 @@ proto_schedule_feed(struct proto *p, int initial)
|
|||
p->main_ahook->out_filter = p->cf->out_filter;
|
||||
p->main_ahook->in_limit = p->cf->in_limit;
|
||||
p->main_ahook->out_limit = p->cf->out_limit;
|
||||
p->main_ahook->in_keep_rejected = p->cf->in_keep_rejected;
|
||||
p->main_ahook->in_keep_filtered = p->cf->in_keep_filtered;
|
||||
proto_reset_limit(p->main_ahook->in_limit);
|
||||
proto_reset_limit(p->main_ahook->out_limit);
|
||||
}
|
||||
|
@ -1096,11 +1096,11 @@ proto_state_name(struct proto *p)
|
|||
}
|
||||
|
||||
static void
|
||||
proto_show_stats(struct proto_stats *s, int in_keep_rejected)
|
||||
proto_show_stats(struct proto_stats *s, int in_keep_filtered)
|
||||
{
|
||||
if (in_keep_rejected)
|
||||
cli_msg(-1006, " Routes: %u imported, %u rejected, %u exported, %u preferred",
|
||||
s->imp_routes, s->rej_routes, s->exp_routes, s->pref_routes);
|
||||
if (in_keep_filtered)
|
||||
cli_msg(-1006, " Routes: %u imported, %u filtered, %u exported, %u preferred",
|
||||
s->imp_routes, s->filt_routes, s->exp_routes, s->pref_routes);
|
||||
else
|
||||
cli_msg(-1006, " Routes: %u imported, %u exported, %u preferred",
|
||||
s->imp_routes, s->exp_routes, s->pref_routes);
|
||||
|
@ -1142,7 +1142,7 @@ proto_show_basic_info(struct proto *p)
|
|||
proto_show_limit(p->cf->out_limit, "Export limit:");
|
||||
|
||||
if (p->proto_state != PS_DOWN)
|
||||
proto_show_stats(&p->stats, p->cf->in_keep_rejected);
|
||||
proto_show_stats(&p->stats, p->cf->in_keep_filtered);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -91,7 +91,7 @@ struct proto_config {
|
|||
int class; /* SYM_PROTO or SYM_TEMPLATE */
|
||||
u32 debug, mrtdump; /* Debugging bitfields, both use D_* constants */
|
||||
unsigned preference, disabled; /* Generic parameters */
|
||||
int in_keep_rejected; /* Routes rejected in import filter are kept */
|
||||
int in_keep_filtered; /* Routes rejected in import filter are kept */
|
||||
u32 router_id; /* Protocol specific router ID */
|
||||
struct rtable_config *table; /* Table we're attached to */
|
||||
struct filter *in_filter, *out_filter; /* Attached filters */
|
||||
|
@ -107,7 +107,7 @@ struct proto_config {
|
|||
struct proto_stats {
|
||||
/* Import - from protocol to core */
|
||||
u32 imp_routes; /* Number of routes successfully imported to the (adjacent) routing table */
|
||||
u32 rej_routes; /* Number of routes rejected in import filter but kept in the routing table */
|
||||
u32 filt_routes; /* Number of routes rejected in import filter but kept in the routing table */
|
||||
u32 pref_routes; /* Number of routes that are preferred, sum over all routing tables */
|
||||
u32 imp_updates_received; /* Number of route updates received */
|
||||
u32 imp_updates_invalid; /* Number of route updates rejected as invalid */
|
||||
|
@ -412,7 +412,7 @@ struct announce_hook {
|
|||
struct proto_limit *out_limit; /* Output limit */
|
||||
struct proto_stats *stats; /* Per-table protocol statistics */
|
||||
struct announce_hook *next; /* Next hook for the same protocol */
|
||||
int in_keep_rejected; /* Routes rejected in import filter are kept */
|
||||
int in_keep_filtered; /* Routes rejected in import filter are kept */
|
||||
};
|
||||
|
||||
struct announce_hook *proto_add_announce_hook(struct proto *p, struct rtable *t, struct proto_stats *stats);
|
||||
|
|
10
nest/route.h
10
nest/route.h
|
@ -221,13 +221,13 @@ typedef struct rte {
|
|||
} rte;
|
||||
|
||||
#define REF_COW 1 /* Copy this rte on write */
|
||||
#define REF_REJECTED 2 /* Route is rejected by import filter */
|
||||
#define REF_FILTERED 2 /* Route is rejected by import filter */
|
||||
|
||||
/* Route is valid for propagation (may depend on other flags in the future), accepts NULL */
|
||||
static inline int rte_is_valid(rte *r) { return r && !(r->flags & REF_REJECTED); }
|
||||
static inline int rte_is_valid(rte *r) { return r && !(r->flags & REF_FILTERED); }
|
||||
|
||||
/* Route just has REF_REJECTED flag */
|
||||
static inline int rte_is_rejected(rte *r) { return !!(r->flags & REF_REJECTED); }
|
||||
/* Route just has REF_FILTERED flag */
|
||||
static inline int rte_is_filtered(rte *r) { return !!(r->flags & REF_FILTERED); }
|
||||
|
||||
|
||||
/* Types of route announcement, also used as flags */
|
||||
|
@ -271,7 +271,7 @@ struct rt_show_data {
|
|||
struct fib_iterator fit;
|
||||
struct proto *show_protocol;
|
||||
struct proto *export_protocol;
|
||||
int export_mode, primary_only, rejected;
|
||||
int export_mode, primary_only, filtered;
|
||||
struct config *running_on_config;
|
||||
int net_counter, rt_counter, show_counter;
|
||||
int stats, show_for;
|
||||
|
|
|
@ -667,7 +667,7 @@ rte_recalculate(struct announce_hook *ah, net *net, rte *new, ea_list *tmpa, str
|
|||
{
|
||||
/* No changes, ignore the new route */
|
||||
|
||||
if (!rte_is_rejected(new))
|
||||
if (!rte_is_filtered(new))
|
||||
{
|
||||
stats->imp_updates_ignored++;
|
||||
rte_trace_in(D_ROUTES, p, new, "ignored");
|
||||
|
@ -701,7 +701,7 @@ rte_recalculate(struct announce_hook *ah, net *net, rte *new, ea_list *tmpa, str
|
|||
struct proto_limit *l = ah->in_limit;
|
||||
if (l && !old && new)
|
||||
{
|
||||
u32 all_routes = stats->imp_routes + stats->rej_routes;
|
||||
u32 all_routes = stats->imp_routes + stats->filt_routes;
|
||||
|
||||
if (all_routes >= l->limit)
|
||||
proto_notify_limit(ah, l, all_routes);
|
||||
|
@ -715,15 +715,15 @@ rte_recalculate(struct announce_hook *ah, net *net, rte *new, ea_list *tmpa, str
|
|||
}
|
||||
}
|
||||
|
||||
if (new && !rte_is_rejected(new))
|
||||
if (new && !rte_is_filtered(new))
|
||||
stats->imp_updates_accepted++;
|
||||
else
|
||||
stats->imp_withdraws_accepted++;
|
||||
|
||||
if (new)
|
||||
rte_is_rejected(new) ? stats->rej_routes++ : stats->imp_routes++;
|
||||
rte_is_filtered(new) ? stats->filt_routes++ : stats->imp_routes++;
|
||||
if (old)
|
||||
rte_is_rejected(old) ? stats->rej_routes-- : stats->imp_routes--;
|
||||
rte_is_filtered(old) ? stats->filt_routes-- : stats->imp_routes--;
|
||||
|
||||
if (table->config->sorted)
|
||||
{
|
||||
|
@ -929,11 +929,11 @@ rte_update2(struct announce_hook *ah, net *net, rte *new, struct proto *src)
|
|||
stats->imp_updates_filtered++;
|
||||
rte_trace_in(D_FILTERS, p, new, "filtered out");
|
||||
|
||||
if (! ah->in_keep_rejected)
|
||||
if (! ah->in_keep_filtered)
|
||||
goto drop;
|
||||
|
||||
/* new is a private copy, i could modify it */
|
||||
new->flags |= REF_REJECTED;
|
||||
new->flags |= REF_FILTERED;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -948,10 +948,10 @@ rte_update2(struct announce_hook *ah, net *net, rte *new, struct proto *src)
|
|||
stats->imp_updates_filtered++;
|
||||
rte_trace_in(D_FILTERS, p, new, "filtered out");
|
||||
|
||||
if (! ah->in_keep_rejected)
|
||||
if (! ah->in_keep_filtered)
|
||||
goto drop;
|
||||
|
||||
new->flags |= REF_REJECTED;
|
||||
new->flags |= REF_FILTERED;
|
||||
}
|
||||
if (tmpa != old_tmpa && src->store_tmp_attrs)
|
||||
src->store_tmp_attrs(new, tmpa);
|
||||
|
@ -2023,7 +2023,7 @@ rt_show_net(struct cli *c, net *n, struct rt_show_data *d)
|
|||
|
||||
for(e=n->routes; e; e=e->next)
|
||||
{
|
||||
if (rte_is_rejected(e) != d->rejected)
|
||||
if (rte_is_filtered(e) != d->filtered)
|
||||
continue;
|
||||
|
||||
struct ea_list *tmpa;
|
||||
|
|
|
@ -1188,7 +1188,7 @@ bgp_show_proto_info(struct proto *P)
|
|||
cli_msg(-1006, " Source address: %I", p->source_addr);
|
||||
if (P->cf->in_limit)
|
||||
cli_msg(-1006, " Route limit: %d/%d",
|
||||
p->p.stats.imp_routes + p->p.stats.rej_routes, P->cf->in_limit->limit);
|
||||
p->p.stats.imp_routes + p->p.stats.filt_routes, P->cf->in_limit->limit);
|
||||
cli_msg(-1006, " Hold timer: %d/%d",
|
||||
tm_remains(c->hold_timer), c->hold_time);
|
||||
cli_msg(-1006, " Keepalive timer: %d/%d",
|
||||
|
|
Loading…
Reference in a new issue