change in the future.
Saved MRT files can be loaded to BIRD. Unlike MRT save, MRT load uses channels
-and it loads to ipv4 or ipv6 table. All routes loaded from MRT files have
+and loads to ipv4 or ipv6 table. All routes loaded from MRT files have
MRT as their source and they are unreachable.
BIRD implements the main MRT format specification as defined in <rfc id="6396">
<label id="mrt-load-config">
<p>MRT load configuration consists of name of the file to load and
-the table where the loaded routes will be stored. BGP messages are
-loaded according to the time they arrived whith REPLAY ACCELERATE parameter.
+the table where the loaded routes will be stored. Speed of loading
+can be changed with REPLAY ACCELERATE parameter.
<descrip>
- <tag><label id="mrt-table">table <m/name/ | "<m/pattern/"</tag>
+ <tag><label id="mrt-table">table <m/name/</tag>
Specify a routing table where the routes from loaded file should be stored.
<tag><label id="mrt-filename">filename "<m/filename/"</tag>
Specify a filename of the loaded MRT file. Mandatory, see example below.
- <tag><label id="mrt-replay-accelerate">replay accelerate"<m/mrt-replay-accelerate/"</tag>
+ <tag><label id="mrt-replay-accelerate">replay accelerate <m/replay accelerate/</tag>
MRT files with BGP messages will be loaded N-times quicker than they were arriving to BGP.
However, it can be slower if there are too much of the messages. Without this parameter
set, messages will be loaded regularly.
s->class = this_proto->class;
s->proto = this_proto;
this_proto->name = s->name;
- log("/* EMPTY */ , name %s, this %x next %x, prev %x", s->name, s, s->next, s->n.prev);
}
| symbol {
- struct symbol *s = cf_define_symbol(new_config, $1, this_proto->class, proto, this_proto);
+ cf_define_symbol(new_config, $1, this_proto->class, proto, this_proto);
this_proto->name = $1->name;
- log("symbol , name %s, next = %x, prev %x", this_proto->name, s->next, s->n.prev);
- if (s->n.prev)
- log("s->n.prev->next %x", s->n.prev->next);
}
| FROM CF_SYM_KNOWN {
if (($2->class != SYM_TEMPLATE) && ($2->class != SYM_PROTO)) cf_error("Template or protocol name expected");
s->class = this_proto->class;
s->proto = this_proto;
this_proto->name = s->name;
- log("CF_SYM_KNOWN , name %s", this_proto->name);
proto_copy_config(this_proto, $2->proto);
}
| symbol FROM CF_SYM_KNOWN {
- log("CF_SYM_KNOWN, %s", $1->name);
if (($3->class != SYM_TEMPLATE) && ($3->class != SYM_PROTO)) cf_error("Template or protocol name expected");
cf_define_symbol(new_config, $1, this_proto->class, proto, this_proto);
proto_item:
/* EMPTY */
- | DISABLED bool { this_proto->disabled = $2; log("proto item");}
- | DEBUG debug_mask { this_proto->debug = $2; log("proto item"); }
- | MRTDUMP mrtdump_mask { this_proto->mrtdump = $2; log("proto item"); }
- | ROUTER ID idval { this_proto->router_id = $3; log("proto item"); }
- | HOSTNAME text { this_proto->hostname = $2; log("proto item"); }
- | DESCRIPTION text { this_proto->dsc = $2; log("proto item"); }
- | VRF text { this_proto->vrf = if_get_by_name($2); this_proto->vrf_set = 1; log("proto item"); }
- | VRF DEFAULT { this_proto->vrf = NULL; this_proto->vrf_set = 1; log("proto item"); }
+ | DISABLED bool { this_proto->disabled = $2; }
+ | DEBUG debug_mask { this_proto->debug = $2; }
+ | MRTDUMP mrtdump_mask { this_proto->mrtdump = $2; }
+ | ROUTER ID idval { this_proto->router_id = $3; }
+ | HOSTNAME text { this_proto->hostname = $2; }
+ | DESCRIPTION text { this_proto->dsc = $2; }
+ | VRF text { this_proto->vrf = if_get_by_name($2); this_proto->vrf_set = 1; }
+ | VRF DEFAULT { this_proto->vrf = NULL; this_proto->vrf_set = 1; }
;
| dev_proto proto_item ';'
| dev_proto proto_channel ';'
| dev_proto dev_iface_patt ';'
- | dev_proto CHECK LINK bool ';' { DIRECT_CFG->check_link = $4; log("check link");}
+ | dev_proto CHECK LINK bool ';' { DIRECT_CFG->check_link = $4; }
;
dev_iface_init:
mrt_channel_start: bgp_afi
{
const struct bgp_af_desc *desc = bgp_get_af_desc($1);
- log("hereee in afiiiii");
if (!desc)
cf_error("Unknown AFI/SAFI");
this_channel = channel_config_get(&channel_mrtload, desc->name, desc->net, this_proto);
MRTLOAD_CFG->channel_cf = MRTLOAD_BGP_CC;
- log("this channel %x %x", this_channel, MRTLOAD_BGP_CC);
-
- /* New channel */
- if (!MRTLOAD_BGP_CC->desc)
- {
- MRTLOAD_BGP_CC->c.in_filter = FILTER_ACCEPT;
- MRTLOAD_BGP_CC->c.out_filter = FILTER_REJECT;
- MRTLOAD_BGP_CC->c.ra_mode = RA_UNDEF;
- MRTLOAD_BGP_CC->afi = $1;
- MRTLOAD_BGP_CC->desc = desc;
- MRTLOAD_BGP_CC->next_hop_keep = 0xff; /* undefined */
- MRTLOAD_BGP_CC->gr_able = 0xff; /* undefined */
- MRTLOAD_BGP_CC->llgr_able = 0xff; /* undefined */
- MRTLOAD_BGP_CC->llgr_time = ~0U; /* undefined */
- MRTLOAD_BGP_CC->min_llgr_time = ~0U; /* undefined */
- MRTLOAD_BGP_CC->max_llgr_time = ~0U; /* undefined */
- MRTLOAD_BGP_CC->aigp = 0xff; /* undefined */
- }
-};
-mrt_channel_item:
- /* empty */
- | channel_item ';'
- ;
+ MRTLOAD_BGP_CC->c.in_filter = FILTER_ACCEPT;
+ MRTLOAD_BGP_CC->c.out_filter = FILTER_REJECT;
+ MRTLOAD_BGP_CC->c.ra_mode = RA_UNDEF;
+ MRTLOAD_BGP_CC->afi = $1;
+ MRTLOAD_BGP_CC->desc = desc;
+ MRTLOAD_BGP_CC->next_hop_keep = 0xff; /* undefined */
+ MRTLOAD_BGP_CC->gr_able = 0xff; /* undefined */
+ MRTLOAD_BGP_CC->llgr_able = 0xff; /* undefined */
+ MRTLOAD_BGP_CC->llgr_time = ~0U; /* undefined */
+ MRTLOAD_BGP_CC->min_llgr_time = ~0U; /* undefined */
+ MRTLOAD_BGP_CC->max_llgr_time = ~0U; /* undefined */
+ MRTLOAD_BGP_CC->aigp = 0xff; /* undefined */
+};
-mrt_proto_channel: mrt_channel_start //mrt_channel_item;
+mrt_proto_channel: mrt_channel_start;
mrtload_proto_opts:
/* empty */
mrtload_proto_item:
proto_item
- | FILENAME text { MRTLOAD_CFG->filename = $2; log("file %s", $2);}
+ | FILENAME text { MRTLOAD_CFG->filename = $2; }
| REPLAY ACCELERATE expr { MRTLOAD_CFG->replay_accel = $3; }
| TABLE rtable {
MRTLOAD_CFG->table_cf = $2;
- log("table_cf %x, MRTLOAD_BGP_CC %x", $2, MRTLOAD_BGP_CC);
- if ($2->addr_type == NET_IP4){
+ if ($2->addr_type == NET_IP4)
MRTLOAD_BGP_CC->igp_table_ip4 = $2;
- log("MRTLOAD_BGP_CC->igp_table_ip4");}
- else if ($2->addr_type == NET_IP6){
+ else if ($2->addr_type == NET_IP6)
MRTLOAD_BGP_CC->igp_table_ip6 = $2;
- log("MRTLOAD_BGP_CC->igp_table_ip6");}
else
cf_error("Mismatched IGP table type");
}
return;
}
- tm_start(p->load_timer, 10000);
+ tm_start(p->load_timer, 10000); //TODO: this constant was found with a heuristic for my computer
}
static void
{
for (int i = 0; i < p->table_peers_count; i++)
mb_free(p->table_peers[i].route_attrs);
+
mb_free(p->table_peers);
+ p->table_peers = NULL;
}
return PS_DOWN;
static int
mrtload_reconfigure(struct proto *P, struct proto_config *CF UNUSED)
{
- log("mrtload_reconfigure");
struct mrtload_proto *p = (void *) P;
FIB_WALK(&p->channel->c.table->fib, net, n)
mrtload_channel_reconfigure(struct channel *C UNUSED, struct channel_config *CC UNUSED,
int *import_changed UNUSED, int *export_changed UNUSED)
{
- log("mrtload_channel_reconfigure");
- return 0; // Even if no variable was changed, the content of MRT file might be changed
+ /* Even if no variable was changed, the content of MRT file might be changed */
+ return 0;
}
const struct channel_class channel_mrtload = {