summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2019-08-13 18:22:07 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2019-08-14 06:02:33 +0200
commitb7d7599ce3576f28310af18b403fed49a0840b67 (patch)
tree7d7dc8f052d564c3fdbc49eea529f22850ab44ff /proto
parentdfe63ed84d42178a53b01071c64f23250e74d6d9 (diff)
BGP: implement Adj-RIB-Out
The patch implements optional internal export table to a channel and hooks it to BGP so it can be used as Adj-RIB-Out. When enabled, all exported (post-filtered) routes are stored there. An export table can be examined using e.g. 'show route export table bgp1.ipv4'.
Diffstat (limited to 'proto')
-rw-r--r--proto/bgp/bgp.c4
-rw-r--r--proto/bgp/bgp.h1
-rw-r--r--proto/bgp/config.Y1
3 files changed, 6 insertions, 0 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index c08e5ee9..01f61e81 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -1721,6 +1721,9 @@ bgp_channel_start(struct channel *C)
if (c->cf->import_table)
channel_setup_in_table(C);
+ if (c->cf->export_table)
+ channel_setup_out_table(C);
+
c->stale_timer = tm_new_init(c->pool, bgp_long_lived_stale_timeout, c, 0, 0);
c->next_hop_addr = c->cf->next_hop_addr;
@@ -2067,6 +2070,7 @@ bgp_channel_reconfigure(struct channel *C, struct channel_config *CC, int *impor
(new->ext_next_hop != old->ext_next_hop) ||
(new->add_path != old->add_path) ||
(new->import_table != old->import_table) ||
+ (new->export_table != old->export_table) ||
(IGP_TABLE(new, ip4) != IGP_TABLE(old, ip4)) ||
(IGP_TABLE(new, ip6) != IGP_TABLE(old, ip6)))
return 0;
diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h
index 2651677c..f9a19d53 100644
--- a/proto/bgp/bgp.h
+++ b/proto/bgp/bgp.h
@@ -150,6 +150,7 @@ struct bgp_channel_config {
u8 ext_next_hop; /* Allow both IPv4 and IPv6 next hops */
u8 add_path; /* Use ADD-PATH extension [RFC 7911] */
u8 import_table; /* Use c.in_table as Adj-RIB-In */
+ u8 export_table; /* Use c.out_table as Adj-RIB-Out */
struct rtable_config *igp_table_ip4; /* Table for recursive IPv4 next hop lookups */
struct rtable_config *igp_table_ip6; /* Table for recursive IPv6 next hop lookups */
diff --git a/proto/bgp/config.Y b/proto/bgp/config.Y
index bbc7d9a4..1407315d 100644
--- a/proto/bgp/config.Y
+++ b/proto/bgp/config.Y
@@ -255,6 +255,7 @@ bgp_channel_item:
| ADD PATHS TX { BGP_CC->add_path = BGP_ADD_PATH_TX; }
| ADD PATHS bool { BGP_CC->add_path = $3 ? BGP_ADD_PATH_FULL : 0; }
| IMPORT TABLE bool { BGP_CC->import_table = $3; }
+ | EXPORT TABLE bool { BGP_CC->export_table = $3; }
| IGP TABLE rtable {
if (BGP_CC->desc->no_igp)
cf_error("IGP table not allowed here");