summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_open.c30
-rw-r--r--bgpd/bgp_vty.c72
2 files changed, 81 insertions, 21 deletions
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index 4037fd8aef..1c3bb6e775 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -1452,8 +1452,10 @@ int bgp_open_option_parse(struct peer *peer, uint16_t length,
/* All OPEN option is parsed. Check capability when strict compare
flag is enabled.*/
if (CHECK_FLAG(peer->flags, PEER_FLAG_STRICT_CAP_MATCH)) {
- /* If Unsupported Capability exists. */
- if (error != error_data) {
+ /* If Unsupported Capability exists or local capability does
+ * not negotiated with remote peer
+ */
+ if (error != error_data || !strict_capability_same(peer)) {
bgp_notify_send_with_data(peer->connection,
BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_UNSUP_CAPBL,
@@ -1461,14 +1463,6 @@ int bgp_open_option_parse(struct peer *peer, uint16_t length,
error - error_data);
return -1;
}
-
- /* Check local capability does not negotiated with remote
- peer. */
- if (!strict_capability_same(peer)) {
- bgp_notify_send(peer->connection, BGP_NOTIFY_OPEN_ERR,
- BGP_NOTIFY_OPEN_UNSUP_CAPBL);
- return -1;
- }
}
/* Extended Message Support */
@@ -1503,17 +1497,11 @@ int bgp_open_option_parse(struct peer *peer, uint16_t length,
"%s [Error] Configured AFI/SAFIs do not overlap with received MP capabilities",
peer->host);
- if (error != error_data)
- bgp_notify_send_with_data(peer->connection,
- BGP_NOTIFY_OPEN_ERR,
- BGP_NOTIFY_OPEN_UNSUP_CAPBL,
- error_data,
- error - error_data);
- else
- bgp_notify_send(peer->connection,
- BGP_NOTIFY_OPEN_ERR,
- BGP_NOTIFY_OPEN_UNSUP_CAPBL);
- return -1;
+ bgp_notify_send_with_data(peer->connection,
+ BGP_NOTIFY_OPEN_ERR,
+ BGP_NOTIFY_OPEN_UNSUP_CAPBL,
+ error_data,
+ error - error_data);
}
}
return 0;
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 9faba65a58..05d3c097b7 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -17711,6 +17711,76 @@ DEFUN (bgp_redistribute_ipv6_rmap_metric,
return bgp_redistribute_set(bgp, AFI_IP6, type, 0, changed);
}
+DEFPY(bgp_redistribute_ipv6_table, bgp_redistribute_ipv6_table_cmd,
+ "redistribute table-direct (1-65535)$table_id [{metric$metric (0-4294967295)$metric_val|route-map WORD$rmap}]",
+ "Redistribute information from another routing protocol\n"
+ "Non-main Kernel Routing Table - Direct\n"
+ "Table ID\n"
+ "Metric for redistributed routes\n"
+ "Default metric\n"
+ "Route map reference\n"
+ "Pointer to route-map entries\n")
+{
+ VTY_DECLVAR_CONTEXT(bgp, bgp);
+ bool changed = false;
+ struct route_map *route_map = NULL;
+ struct bgp_redist *red;
+
+ if (rmap)
+ route_map = route_map_lookup_warn_noexist(vty, rmap);
+
+ if (bgp->vrf_id != VRF_DEFAULT) {
+ vty_out(vty,
+ "%% Only default BGP instance can use 'table-direct'\n");
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+ if (table_id == RT_TABLE_MAIN || table_id == RT_TABLE_LOCAL) {
+ vty_out(vty,
+ "%% 'table-direct', can not use %lu routing table\n",
+ table_id);
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
+ red = bgp_redist_add(bgp, AFI_IP6, ZEBRA_ROUTE_TABLE_DIRECT, table_id);
+ if (rmap)
+ changed = bgp_redistribute_rmap_set(red, rmap, route_map);
+ if (metric)
+ changed |= bgp_redistribute_metric_set(bgp, red, AFI_IP6,
+ ZEBRA_ROUTE_TABLE_DIRECT,
+ metric_val);
+ return bgp_redistribute_set(bgp, AFI_IP6, ZEBRA_ROUTE_TABLE_DIRECT,
+ table_id, changed);
+}
+
+DEFPY(no_bgp_redistribute_ipv6_table, no_bgp_redistribute_ipv6_table_cmd,
+ "no redistribute table-direct (1-65535)$table_id [{metric (0-4294967295)|route-map WORD}]",
+ NO_STR
+ "Redistribute information from another routing protocol\n"
+ "Non-main Kernel Routing Table - Direct\n"
+ "Table ID\n"
+ "Metric for redistributed routes\n"
+ "Default metric\n"
+ "Route map reference\n"
+ "Pointer to route-map entries\n")
+{
+ VTY_DECLVAR_CONTEXT(bgp, bgp);
+
+ if (bgp->vrf_id != VRF_DEFAULT) {
+ vty_out(vty,
+ "%% Only default BGP instance can use 'table-direct'\n");
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+ if (table_id == RT_TABLE_MAIN || table_id == RT_TABLE_LOCAL) {
+ vty_out(vty,
+ "%% 'table-direct', can not use %lu routing table\n",
+ table_id);
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
+ bgp_redistribute_unset(bgp, AFI_IP6, ZEBRA_ROUTE_TABLE_DIRECT, table_id);
+ return CMD_SUCCESS;
+}
+
DEFUN (bgp_redistribute_ipv6_metric_rmap,
bgp_redistribute_ipv6_metric_rmap_cmd,
"redistribute " FRR_IP6_REDIST_STR_BGPD " metric (0-4294967295) route-map RMAP_NAME",
@@ -21368,6 +21438,8 @@ void bgp_vty_init(void)
install_element(BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
install_element(BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
install_element(BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
+ install_element(BGP_IPV6_NODE, &bgp_redistribute_ipv6_table_cmd);
+ install_element(BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_table_cmd);
/* import|export vpn [route-map RMAP_NAME] */
install_element(BGP_IPV4_NODE, &bgp_imexport_vpn_cmd);