T7297: frr: add ospf redistribute table-direct

Cherry-pick 84b4b6300585d0747d9794ee2f7c96920ce4a02c as
patch 0006-ospfd-support-table-direct-redistribution.patch
to support `table-direct` in ospf redistribute
This commit is contained in:
Kyrylo Yatsenko 2025-09-05 09:51:23 +03:00
parent dc1bc10e3a
commit a1a6487692

View File

@ -0,0 +1,58 @@
From cbc1602bc6be411bebce2fd9cef712622a1b1799 Mon Sep 17 00:00:00 2001
From: Rafael Zalamena <rzalamena@opensourcerouting.org>
Date: Fri, 15 Dec 2023 14:24:17 -0300
Subject: [PATCH] ospfd: support table-direct redistribution
Add the 'table-direct' option to the redistribute command in OSPF.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
---
ospfd/ospf_vty.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index ccc46424bc..3594ad5e2c 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -9321,10 +9321,11 @@ DEFUN (no_ospf_redistribute_source,
DEFUN (ospf_redistribute_instance_source,
ospf_redistribute_instance_source_cmd,
- "redistribute <ospf|table> (1-65535) [{metric (0-16777214)|metric-type (1-2)|route-map RMAP_NAME}]",
+ "redistribute <ospf|table|table-direct> (1-65535) [{metric (0-16777214)|metric-type (1-2)|route-map RMAP_NAME}]",
REDIST_STR
"Open Shortest Path First\n"
"Non-main Kernel Routing Table\n"
+ "Non-main Kernel Routing Table - Direct\n"
"Instance ID/Table ID\n"
"Metric for redistributed routes\n"
"OSPF default metric\n"
@@ -9397,11 +9398,12 @@ DEFUN (ospf_redistribute_instance_source,
DEFUN (no_ospf_redistribute_instance_source,
no_ospf_redistribute_instance_source_cmd,
- "no redistribute <ospf|table> (1-65535) [{metric (0-16777214)|metric-type (1-2)|route-map RMAP_NAME}]",
+ "no redistribute <ospf|table|table-direct> (1-65535) [{metric (0-16777214)|metric-type (1-2)|route-map RMAP_NAME}]",
NO_STR
REDIST_STR
"Open Shortest Path First\n"
"Non-main Kernel Routing Table\n"
+ "Non-main Kernel Routing Table - Direct\n"
"Instance ID/Table Id\n"
"Metric for redistributed routes\n"
"OSPF default metric\n"
@@ -9417,10 +9419,7 @@ DEFUN (no_ospf_redistribute_instance_source,
struct ospf_redist *red;
int source;
- if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0)
- source = ZEBRA_ROUTE_OSPF;
- else
- source = ZEBRA_ROUTE_TABLE;
+ source = proto_redistnum(AFI_IP, argv[idx_ospf_table]->text);
instance = strtoul(argv[idx_number]->arg, NULL, 10);
--
2.50.1