From 07a459ac25e2b17464ccabf9df6ca07ae6887531 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Wed, 17 Jun 2020 14:11:35 +0200 Subject: [PATCH] lib: add support for new redistribute table-direct element Add a new kind of redistributed route that helps to import entries that are not copied in the default routing table. Contrary to the 'redistribute table' feature, the entries are directly obtained from the zebra appropriate routing table. The 'table-direct' naming expresses the direct redistribution of the routes, without having to copy the route entries in the default routing table. The distance value for this route is 14. Such route entries will be prioritary compared to 'table' and 'ebgp' route entries type. Signed-off-by: Philippe Guibert --- lib/log.c | 4 ++++ lib/route_types.txt | 2 ++ lib/zebra.h | 1 + 3 files changed, 7 insertions(+) diff --git a/lib/log.c b/lib/log.c index ac31faa795..306c995c15 100644 --- a/lib/log.c +++ b/lib/log.c @@ -573,6 +573,8 @@ int proto_redistnum(int afi, const char *s) return ZEBRA_ROUTE_SHARP; else if (strmatch(s, "openfabric")) return ZEBRA_ROUTE_OPENFABRIC; + else if (strmatch(s, "table-direct")) + return ZEBRA_ROUTE_TABLE_DIRECT; } if (afi == AFI_IP6) { if (strmatch(s, "kernel")) @@ -603,6 +605,8 @@ int proto_redistnum(int afi, const char *s) return ZEBRA_ROUTE_SHARP; else if (strmatch(s, "openfabric")) return ZEBRA_ROUTE_OPENFABRIC; + else if (strmatch(s, "table-direct")) + return ZEBRA_ROUTE_TABLE_DIRECT; } return -1; } diff --git a/lib/route_types.txt b/lib/route_types.txt index a82273a6dc..07289e1e08 100644 --- a/lib/route_types.txt +++ b/lib/route_types.txt @@ -86,6 +86,7 @@ ZEBRA_ROUTE_OPENFABRIC, openfabric, fabricd, 'f', 1, 1, 1, "OpenFabric", fa ZEBRA_ROUTE_VRRP, vrrp, vrrpd, '-', 0, 0, 0, "VRRP", vrrpd ZEBRA_ROUTE_NHG, zebra, none, '-', 0, 0, 0, "Nexthop Group", none ZEBRA_ROUTE_SRTE, srte, none, '-', 0, 0, 0, "SR-TE", none +ZEBRA_ROUTE_TABLE_DIRECT, table-direct, zebra, 't', 1, 1, 1, "Table-Direct", zebra ZEBRA_ROUTE_ALL, wildcard, none, '-', 0, 0, 0, "-", none @@ -116,3 +117,4 @@ ZEBRA_ROUTE_BFD, "Bidirectional Fowarding Detection (BFD)" ZEBRA_ROUTE_VRRP, "Virtual Router Redundancy Protocol (VRRP)" ZEBRA_ROUTE_OPENFABRIC, "OpenFabric Routing Protocol" ZEBRA_ROUTE_NHG, "Zebra Nexthop Groups (NHG)" +ZEBRA_ROUTE_TABLE_DIRECT, "Non-main Kernel Routing Table - Direct" diff --git a/lib/zebra.h b/lib/zebra.h index ecc87f58f1..42e6a97ff8 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -370,6 +370,7 @@ typedef enum { #define ZEBRA_IBGP_DISTANCE_DEFAULT 200 #define ZEBRA_EBGP_DISTANCE_DEFAULT 20 #define ZEBRA_TABLE_DISTANCE_DEFAULT 15 +#define ZEBRA_TABLEDIRECT_DISTANCE_DEFAULT 14 #define ZEBRA_EIGRP_DISTANCE_DEFAULT 90 #define ZEBRA_NHRP_DISTANCE_DEFAULT 10 #define ZEBRA_LDP_DISTANCE_DEFAULT 150 -- 2.39.5