mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-24 16:33:40 +00:00
bgpd: add redistribute table-direct command for ipv6-unicast
The 'table-direct' redistribute command is available for ipv4 unicast but
not for ipv6 unicast.
Add the command to ipv6 unicast as well.
Fixes: b6367f8460
("bgpd: add redistribute table-direct support")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
This commit is contained in:
parent
314e9f9803
commit
2a384f14c1
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user