mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 22:00:00 +00:00
bgpd: allow table-direct on different VRFs
Allow table-direct to be configured in different VRFs. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This commit is contained in:
parent
28a9ca3405
commit
7bcb2f5193
@ -17598,12 +17598,6 @@ DEFUN (bgp_redistribute_ipv4_ospf,
|
|||||||
if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0)
|
if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0)
|
||||||
protocol = ZEBRA_ROUTE_OSPF;
|
protocol = ZEBRA_ROUTE_OSPF;
|
||||||
else {
|
else {
|
||||||
if (bgp->vrf_id != VRF_DEFAULT) {
|
|
||||||
vty_out(vty,
|
|
||||||
"%% Only default BGP instance can use '%s'\n",
|
|
||||||
argv[idx_ospf_table]->arg);
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
}
|
|
||||||
if (strncmp(argv[idx_ospf_table]->arg, "table-direct",
|
if (strncmp(argv[idx_ospf_table]->arg, "table-direct",
|
||||||
strlen("table-direct")) == 0) {
|
strlen("table-direct")) == 0) {
|
||||||
protocol = ZEBRA_ROUTE_TABLE_DIRECT;
|
protocol = ZEBRA_ROUTE_TABLE_DIRECT;
|
||||||
@ -17657,12 +17651,6 @@ DEFUN (bgp_redistribute_ipv4_ospf_rmap,
|
|||||||
if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0)
|
if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0)
|
||||||
protocol = ZEBRA_ROUTE_OSPF;
|
protocol = ZEBRA_ROUTE_OSPF;
|
||||||
else {
|
else {
|
||||||
if (bgp->vrf_id != VRF_DEFAULT) {
|
|
||||||
vty_out(vty,
|
|
||||||
"%% Only default BGP instance can use '%s'\n",
|
|
||||||
argv[idx_ospf_table]->arg);
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
}
|
|
||||||
if (strncmp(argv[idx_ospf_table]->arg, "table-direct",
|
if (strncmp(argv[idx_ospf_table]->arg, "table-direct",
|
||||||
strlen("table-direct")) == 0) {
|
strlen("table-direct")) == 0) {
|
||||||
protocol = ZEBRA_ROUTE_TABLE_DIRECT;
|
protocol = ZEBRA_ROUTE_TABLE_DIRECT;
|
||||||
@ -17720,12 +17708,6 @@ DEFUN (bgp_redistribute_ipv4_ospf_metric,
|
|||||||
if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0)
|
if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0)
|
||||||
protocol = ZEBRA_ROUTE_OSPF;
|
protocol = ZEBRA_ROUTE_OSPF;
|
||||||
else {
|
else {
|
||||||
if (bgp->vrf_id != VRF_DEFAULT) {
|
|
||||||
vty_out(vty,
|
|
||||||
"%% Only default BGP instance can use '%s'\n",
|
|
||||||
argv[idx_ospf_table]->arg);
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
}
|
|
||||||
if (strncmp(argv[idx_ospf_table]->arg, "table-direct",
|
if (strncmp(argv[idx_ospf_table]->arg, "table-direct",
|
||||||
strlen("table-direct")) == 0) {
|
strlen("table-direct")) == 0) {
|
||||||
protocol = ZEBRA_ROUTE_TABLE_DIRECT;
|
protocol = ZEBRA_ROUTE_TABLE_DIRECT;
|
||||||
@ -17790,12 +17772,6 @@ DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric,
|
|||||||
if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0)
|
if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0)
|
||||||
protocol = ZEBRA_ROUTE_OSPF;
|
protocol = ZEBRA_ROUTE_OSPF;
|
||||||
else {
|
else {
|
||||||
if (bgp->vrf_id != VRF_DEFAULT) {
|
|
||||||
vty_out(vty,
|
|
||||||
"%% Only default BGP instance can use '%s'\n",
|
|
||||||
argv[idx_ospf_table]->arg);
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
}
|
|
||||||
if (strncmp(argv[idx_ospf_table]->arg, "table-direct",
|
if (strncmp(argv[idx_ospf_table]->arg, "table-direct",
|
||||||
strlen("table-direct")) == 0) {
|
strlen("table-direct")) == 0) {
|
||||||
protocol = ZEBRA_ROUTE_TABLE_DIRECT;
|
protocol = ZEBRA_ROUTE_TABLE_DIRECT;
|
||||||
@ -17865,13 +17841,7 @@ DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap,
|
|||||||
if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0)
|
if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0)
|
||||||
protocol = ZEBRA_ROUTE_OSPF;
|
protocol = ZEBRA_ROUTE_OSPF;
|
||||||
else {
|
else {
|
||||||
if (bgp->vrf_id != VRF_DEFAULT) {
|
if (strncmp(argv[idx_ospf_table]->arg, "table-direct", strlen("table-direct")) == 0) {
|
||||||
vty_out(vty,
|
|
||||||
"%% Only default BGP instance can use '%s'\n",
|
|
||||||
argv[idx_ospf_table]->arg);
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
} else if (strncmp(argv[idx_ospf_table]->arg, "table-direct",
|
|
||||||
strlen("table-direct")) == 0) {
|
|
||||||
protocol = ZEBRA_ROUTE_TABLE_DIRECT;
|
protocol = ZEBRA_ROUTE_TABLE_DIRECT;
|
||||||
if (instance == RT_TABLE_MAIN ||
|
if (instance == RT_TABLE_MAIN ||
|
||||||
instance == RT_TABLE_LOCAL) {
|
instance == RT_TABLE_LOCAL) {
|
||||||
@ -17934,12 +17904,6 @@ DEFUN (no_bgp_redistribute_ipv4_ospf,
|
|||||||
if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0)
|
if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0)
|
||||||
protocol = ZEBRA_ROUTE_OSPF;
|
protocol = ZEBRA_ROUTE_OSPF;
|
||||||
else {
|
else {
|
||||||
if (bgp->vrf_id != VRF_DEFAULT) {
|
|
||||||
vty_out(vty,
|
|
||||||
"%% Only default BGP instance can use '%s'\n",
|
|
||||||
argv[idx_ospf_table]->arg);
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
}
|
|
||||||
if (strncmp(argv[idx_ospf_table]->arg, "table-direct",
|
if (strncmp(argv[idx_ospf_table]->arg, "table-direct",
|
||||||
strlen("table-direct")) == 0) {
|
strlen("table-direct")) == 0) {
|
||||||
protocol = ZEBRA_ROUTE_TABLE_DIRECT;
|
protocol = ZEBRA_ROUTE_TABLE_DIRECT;
|
||||||
|
@ -2042,11 +2042,22 @@ int bgp_redistribute_set(struct bgp *bgp, afi_t afi, int type,
|
|||||||
|
|
||||||
/* Return if already redistribute flag is set. */
|
/* Return if already redistribute flag is set. */
|
||||||
if (instance) {
|
if (instance) {
|
||||||
if (redist_check_instance(&zclient->mi_redist[afi][type],
|
if (type == ZEBRA_ROUTE_TABLE_DIRECT) {
|
||||||
instance))
|
struct redist_table_direct table = {
|
||||||
return CMD_WARNING;
|
.table_id = instance,
|
||||||
|
.vrf_id = bgp->vrf_id,
|
||||||
|
};
|
||||||
|
if (redist_lookup_table_direct(&zclient->mi_redist[afi][type], &table) !=
|
||||||
|
NULL)
|
||||||
|
return CMD_WARNING;
|
||||||
|
|
||||||
redist_add_instance(&zclient->mi_redist[afi][type], instance);
|
redist_add_table_direct(&zclient->mi_redist[afi][type], &table);
|
||||||
|
} else {
|
||||||
|
if (redist_check_instance(&zclient->mi_redist[afi][type], instance))
|
||||||
|
return CMD_WARNING;
|
||||||
|
|
||||||
|
redist_add_instance(&zclient->mi_redist[afi][type], instance);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (vrf_bitmap_check(&zclient->redist[afi][type], bgp->vrf_id))
|
if (vrf_bitmap_check(&zclient->redist[afi][type], bgp->vrf_id))
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
@ -2174,10 +2185,22 @@ int bgp_redistribute_unreg(struct bgp *bgp, afi_t afi, int type,
|
|||||||
|
|
||||||
/* Return if zebra connection is disabled. */
|
/* Return if zebra connection is disabled. */
|
||||||
if (instance) {
|
if (instance) {
|
||||||
if (!redist_check_instance(&zclient->mi_redist[afi][type],
|
if (type == ZEBRA_ROUTE_TABLE_DIRECT) {
|
||||||
instance))
|
struct redist_table_direct table = {
|
||||||
return CMD_WARNING;
|
.table_id = instance,
|
||||||
redist_del_instance(&zclient->mi_redist[afi][type], instance);
|
.vrf_id = bgp->vrf_id,
|
||||||
|
};
|
||||||
|
if (redist_lookup_table_direct(&zclient->mi_redist[afi][type], &table) ==
|
||||||
|
NULL)
|
||||||
|
return CMD_WARNING;
|
||||||
|
|
||||||
|
redist_del_table_direct(&zclient->mi_redist[afi][type], &table);
|
||||||
|
} else {
|
||||||
|
if (!redist_check_instance(&zclient->mi_redist[afi][type], instance))
|
||||||
|
return CMD_WARNING;
|
||||||
|
|
||||||
|
redist_del_instance(&zclient->mi_redist[afi][type], instance);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!vrf_bitmap_check(&zclient->redist[afi][type], bgp->vrf_id))
|
if (!vrf_bitmap_check(&zclient->redist[afi][type], bgp->vrf_id))
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
|
Loading…
Reference in New Issue
Block a user