From 6de9f7fbf582cf9ea10803437ce7ec845c43d67a Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sat, 4 Nov 2023 08:47:46 +0000 Subject: [PATCH] *: Move distance related defines into their own header Signed-off-by: Donald Sharp --- bgpd/bgp_route.c | 2 ++ bgpd/bgp_zebra.c | 1 + lib/frrdistance.h | 35 +++++++++++++++++++++++++++++++++++ lib/subdir.am | 1 + lib/zebra.h | 22 ---------------------- ospf6d/ospf6_top.c | 1 + ospfd/ospf_vty.c | 1 + pimd/pim_upstream.c | 1 + ripd/rip_peer.c | 1 + ripd/rip_zebra.c | 2 ++ ripd/ripd.c | 1 + ripngd/ripng_peer.c | 1 + staticd/static_vty.c | 1 + zebra/redistribute.c | 1 + zebra/zapi_msg.c | 1 + zebra/zebra_rib.c | 1 + zebra/zebra_vty.c | 1 + 17 files changed, 52 insertions(+), 22 deletions(-) create mode 100644 lib/frrdistance.h diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index b627487e7c..4ced565d52 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -28,6 +28,8 @@ #include "lib/json.h" #include "lib_errors.h" #include "zclient.h" +#include "frrdistance.h" + #include "bgpd/bgpd.h" #include "bgpd/bgp_table.h" #include "bgpd/bgp_route.h" diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 381acd803e..65ac92ef05 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -24,6 +24,7 @@ #include "mpls.h" #include "vxlan.h" #include "pbr.h" +#include "frrdistance.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_route.h" diff --git a/lib/frrdistance.h b/lib/frrdistance.h new file mode 100644 index 0000000000..d2fa76e610 --- /dev/null +++ b/lib/frrdistance.h @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Zebra distance header + * Copyright (C) 2023 NVIDIA Corporation + * Donald Sharp + * + * Distance related defines. FRR needs a common set + * of values for distance. + */ +#ifndef __FRRDISTANCE_H__ +#define __FRRDISTANCE_H__ + +/* Default Administrative Distance of each protocol. */ +#define ZEBRA_KERNEL_DISTANCE_DEFAULT 0 +#define ZEBRA_CONNECT_DISTANCE_DEFAULT 0 +#define ZEBRA_STATIC_DISTANCE_DEFAULT 1 +#define ZEBRA_RIP_DISTANCE_DEFAULT 120 +#define ZEBRA_RIPNG_DISTANCE_DEFAULT 120 +#define ZEBRA_OSPF_DISTANCE_DEFAULT 110 +#define ZEBRA_OSPF6_DISTANCE_DEFAULT 110 +#define ZEBRA_ISIS_DISTANCE_DEFAULT 115 +#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 +#define ZEBRA_BABEL_DISTANCE_DEFAULT 100 +#define ZEBRA_SHARP_DISTANCE_DEFAULT 150 +#define ZEBRA_PBR_DISTANCE_DEFAULT 200 +#define ZEBRA_OPENFABRIC_DISTANCE_DEFAULT 115 +#define ZEBRA_MAX_DISTANCE_DEFAULT 255 + +#endif diff --git a/lib/subdir.am b/lib/subdir.am index d7b28ffbd5..0c718d12aa 100644 --- a/lib/subdir.am +++ b/lib/subdir.am @@ -219,6 +219,7 @@ pkginclude_HEADERS += \ lib/filter.h \ lib/flex_algo.h \ lib/freebsd-queue.h \ + lib/frrdistance.h \ lib/frrlua.h \ lib/frrscript.h \ lib/frr_pthread.h \ diff --git a/lib/zebra.h b/lib/zebra.h index 378ccd84d0..e5021df22b 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -350,28 +350,6 @@ typedef enum { for (afi = AFI_IP; afi < AFI_MAX; afi++) \ for (safi = SAFI_UNICAST; safi <= SAFI_MPLS_VPN; safi++) -/* Default Administrative Distance of each protocol. */ -#define ZEBRA_KERNEL_DISTANCE_DEFAULT 0 -#define ZEBRA_CONNECT_DISTANCE_DEFAULT 0 -#define ZEBRA_STATIC_DISTANCE_DEFAULT 1 -#define ZEBRA_RIP_DISTANCE_DEFAULT 120 -#define ZEBRA_RIPNG_DISTANCE_DEFAULT 120 -#define ZEBRA_OSPF_DISTANCE_DEFAULT 110 -#define ZEBRA_OSPF6_DISTANCE_DEFAULT 110 -#define ZEBRA_ISIS_DISTANCE_DEFAULT 115 -#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 -#define ZEBRA_BABEL_DISTANCE_DEFAULT 100 -#define ZEBRA_SHARP_DISTANCE_DEFAULT 150 -#define ZEBRA_PBR_DISTANCE_DEFAULT 200 -#define ZEBRA_OPENFABRIC_DISTANCE_DEFAULT 115 -#define ZEBRA_MAX_DISTANCE_DEFAULT 255 - /* Flag manipulation macros. */ #define CHECK_FLAG(V,F) ((V) & (F)) #define SET_FLAG(V,F) (V) |= (F) diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 216837d8a5..aa0625814c 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -16,6 +16,7 @@ #include "defaults.h" #include "lib/json.h" #include "lib_errors.h" +#include "frrdistance.h" #include "ospf6_proto.h" #include "ospf6_message.h" diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index ab412e3606..f6ea5c6ef9 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -22,6 +22,7 @@ #include "defaults.h" #include "lib/printfrr.h" #include "keychain.h" +#include "frrdistance.h" #include "ospfd/ospfd.h" #include "ospfd/ospf_asbr.h" diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index e36bd82ac6..335c8a454b 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -17,6 +17,7 @@ #include "jhash.h" #include "wheel.h" #include "network.h" +#include "frrdistance.h" #include "pimd.h" #include "pim_pim.h" diff --git a/ripd/rip_peer.c b/ripd/rip_peer.c index 3e8ddeccf2..7e848bee47 100644 --- a/ripd/rip_peer.c +++ b/ripd/rip_peer.c @@ -12,6 +12,7 @@ #include "frrevent.h" #include "memory.h" #include "table.h" +#include "frrdistance.h" #include "ripd/ripd.h" #include "ripd/rip_bfd.h" diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c index 36b58cb20b..ce94e8e754 100644 --- a/ripd/rip_zebra.c +++ b/ripd/rip_zebra.c @@ -14,6 +14,8 @@ #include "log.h" #include "vrf.h" #include "bfd.h" +#include "frrdistance.h" + #include "ripd/ripd.h" #include "ripd/rip_debug.h" #include "ripd/rip_interface.h" diff --git a/ripd/ripd.c b/ripd/ripd.c index 7bfcaadc74..f197e389b2 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -31,6 +31,7 @@ #include "northbound_cli.h" #include "network.h" #include "lib/printfrr.h" +#include "frrdistance.h" #include "ripd/ripd.h" #include "ripd/rip_nb.h" diff --git a/ripngd/ripng_peer.c b/ripngd/ripng_peer.c index 901b548a42..247bac4697 100644 --- a/ripngd/ripng_peer.c +++ b/ripngd/ripng_peer.c @@ -15,6 +15,7 @@ #include "linklist.h" #include "frrevent.h" #include "memory.h" +#include "frrdistance.h" #include "ripngd/ripngd.h" #include "ripngd/ripng_nexthop.h" diff --git a/staticd/static_vty.c b/staticd/static_vty.c index 0582df88ab..4ca3c2e921 100644 --- a/staticd/static_vty.c +++ b/staticd/static_vty.c @@ -19,6 +19,7 @@ #include "libfrr.h" #include "routing_nb.h" #include "northbound_cli.h" +#include "frrdistance.h" #include "static_vrf.h" #include "static_vty.h" diff --git a/zebra/redistribute.c b/zebra/redistribute.c index 6121949ced..b0681bb09f 100644 --- a/zebra/redistribute.c +++ b/zebra/redistribute.c @@ -16,6 +16,7 @@ #include "log.h" #include "vrf.h" #include "srcdest_table.h" +#include "frrdistance.h" #include "zebra/rib.h" #include "zebra/zebra_router.h" diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 856c906bdc..34977a9143 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -24,6 +24,7 @@ #include "lib/vrf.h" #include "lib/libfrr.h" #include "lib/lib_errors.h" +#include "lib/frrdistance.h" #include "zebra/zebra_router.h" #include "zebra/rib.h" diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index a4af3a43ff..05ac3f3d8e 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -29,6 +29,7 @@ #include "frr_pthread.h" #include "printfrr.h" #include "frrscript.h" +#include "frrdistance.h" #include "zebra/zebra_router.h" #include "zebra/connected.h" diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 8c97248737..a584cf638d 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -20,6 +20,7 @@ #include "vxlan.h" #include "termtable.h" #include "affinitymap.h" +#include "frrdistance.h" #include "zebra/zebra_router.h" #include "zebra/zserv.h"