summaryrefslogtreecommitdiff
path: root/nest
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2014-10-14 17:23:34 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2014-10-14 17:23:34 +0200
commit78342404ff573e85e396f0611014b90cea9b4c0a (patch)
tree39fd70db506dc05d83528b7afab258b07b8ac482 /nest
parent178a197afb77770d8a90765e39065679936a45d1 (diff)
parentcfdea7b85f6c520cc5a62eb907d2190db14c9900 (diff)
Merge remote-tracking branch 'origin/master' into soft-int
Diffstat (limited to 'nest')
-rw-r--r--nest/config.Y17
-rw-r--r--nest/route.h6
-rw-r--r--nest/rt-attr.c2
-rw-r--r--nest/rt-table.c15
4 files changed, 26 insertions, 14 deletions
diff --git a/nest/config.Y b/nest/config.Y
index eef7422c..59a776bf 100644
--- a/nest/config.Y
+++ b/nest/config.Y
@@ -57,10 +57,10 @@ CF_KEYWORDS(ROUTER, ID, PROTOCOL, TEMPLATE, PREFERENCE, DISABLED, DEBUG, ALL, OF
CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE, TABLE, STATES, ROUTES, FILTERS)
CF_KEYWORDS(RECEIVE, 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, AS)
+CF_KEYWORDS(PRIMARY, STATS, COUNT, FOR, COMMANDS, PREEXPORT, NOEXPORT, GENERATE, ROA)
CF_KEYWORDS(LISTEN, BGP, V6ONLY, DUAL, ADDRESS, PORT, PASSWORDS, DESCRIPTION, SORTED)
CF_KEYWORDS(RELOAD, IN, OUT, MRTDUMP, MESSAGES, RESTRICT, MEMORY, IGP_METRIC, CLASS, DSCP)
-CF_KEYWORDS(GRACEFUL, RESTART, WAIT)
+CF_KEYWORDS(GRACEFUL, RESTART, WAIT, MAX, FLUSH, AS)
CF_ENUM(T_ENUM_RTS, RTS_, DUMMY, STATIC, INHERIT, DEVICE, STATIC_DEVICE, REDIRECT,
RIP, OSPF, OSPF_IA, OSPF_EXT1, OSPF_EXT2, BGP, PIPE)
@@ -77,7 +77,7 @@ CF_ENUM(T_ENUM_ROA, ROA_, UNKNOWN, VALID, INVALID)
%type <ro> roa_args
%type <rot> roa_table_arg
%type <sd> sym_args
-%type <i> proto_start echo_mask echo_size debug_mask debug_list debug_flag mrtdump_mask mrtdump_list mrtdump_flag export_or_preexport roa_mode limit_action tab_sorted tos
+%type <i> proto_start echo_mask echo_size debug_mask debug_list debug_flag mrtdump_mask mrtdump_list mrtdump_flag export_mode roa_mode limit_action tab_sorted tos
%type <ps> proto_patt proto_patt2
%type <g> limit_spec
@@ -443,7 +443,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] [filtered] [(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|noexport) <p>] [protocol <p>] [stats|count]]], [[Show routing table]])
{ rt_show($3); } ;
r_args:
@@ -492,7 +492,7 @@ r_args:
$$ = $1;
$$->filtered = 1;
}
- | r_args export_or_preexport SYM {
+ | r_args export_mode SYM {
struct proto_config *c = (struct proto_config *) $3->def;
$$ = $1;
if ($$->export_mode) cf_error("Protocol specified twice");
@@ -519,9 +519,10 @@ r_args:
}
;
-export_or_preexport:
- PREEXPORT { $$ = 1; }
- | EXPORT { $$ = 2; }
+export_mode:
+ PREEXPORT { $$ = RSEM_PREEXPORT; }
+ | EXPORT { $$ = RSEM_EXPORT; }
+ | NOEXPORT { $$ = RSEM_NOEXPORT; }
;
diff --git a/nest/route.h b/nest/route.h
index 82d9e202..5ee04a30 100644
--- a/nest/route.h
+++ b/nest/route.h
@@ -301,6 +301,12 @@ struct rt_show_data {
};
void rt_show(struct rt_show_data *);
+/* Value of export_mode in struct rt_show_data */
+#define RSEM_NONE 0 /* Export mode not used */
+#define RSEM_PREEXPORT 1 /* Routes ready for export, before filtering */
+#define RSEM_EXPORT 2 /* Routes accepted by export filter */
+#define RSEM_NOEXPORT 3 /* Routes rejected by export filter */
+
/*
* Route Attributes
*
diff --git a/nest/rt-attr.c b/nest/rt-attr.c
index 97a1bc27..09691bf1 100644
--- a/nest/rt-attr.c
+++ b/nest/rt-attr.c
@@ -815,7 +815,7 @@ rta_alloc_hash(void)
static inline unsigned int
rta_hash(rta *a)
{
- return (((unsigned) a->src) ^ ipa_hash(a->gw) ^
+ return (((uint) (uintptr_t) a->src) ^ ipa_hash(a->gw) ^
mpnh_hash(a->nexthops) ^ ea_hash(a->eattrs)) & 0xffff;
}
diff --git a/nest/rt-table.c b/nest/rt-table.c
index 4c889d0d..59fd0711 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -645,7 +645,7 @@ rte_recalculate(struct announce_hook *ah, net *net, rte *new, ea_list *tmpa, str
struct proto *p = ah->proto;
struct rtable *table = ah->table;
struct proto_stats *stats = ah->stats;
- static struct rate_limit rl_pipe;
+ static struct tbf rl_pipe = TBF_DEFAULT_LOG_LIMITS;
rte *before_old = NULL;
rte *old_best = net->routes;
rte *old = NULL;
@@ -1367,7 +1367,7 @@ rt_init(void)
static int
rt_prune_step(rtable *tab, int step, int *limit)
{
- static struct rate_limit rl_flush;
+ static struct tbf rl_flush = TBF_DEFAULT_LOG_LIMITS;
struct fib_iterator *fit = &tab->prune_fit;
DBG("Pruning route table %s\n", tab->name);
@@ -2255,6 +2255,9 @@ rt_show_net(struct cli *c, net *n, struct rt_show_data *d)
if (d->export_mode)
{
+ if (! d->export_protocol->rt_notify)
+ return;
+
a = proto_find_announce_hook(d->export_protocol, d->table);
if (!a)
return;
@@ -2287,18 +2290,20 @@ rt_show_net(struct cli *c, net *n, struct rt_show_data *d)
if (ic < 0)
goto skip;
- if (d->export_mode > 1)
+ if (d->export_mode > RSEM_PREEXPORT)
{
/*
* FIXME - This shows what should be exported according to current
* filters, but not what was really exported. 'configure soft'
* command may change the export filter and do not update routes.
*/
+ int do_export = (ic > 0) ||
+ (f_run(a->out_filter, &e, &tmpa, rte_update_pool, FF_FORCE_TMPATTR) <= F_ACCEPT);
- if (!ic && (f_run(a->out_filter, &e, &tmpa, rte_update_pool, FF_FORCE_TMPATTR) > F_ACCEPT))
+ if (do_export != (d->export_mode == RSEM_EXPORT))
goto skip;
- if (ep->accept_ra_types == RA_ACCEPTED)
+ if ((d->export_mode == RSEM_EXPORT) && (ep->accept_ra_types == RA_ACCEPTED))
pass = 1;
}
}