From 4877f2f6856366734a9419aaf9616785242c935a Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Thu, 26 Dec 2024 23:08:21 +0200 Subject: [PATCH] lib: remove VRF_BACKEND_UNKNOWN The backend type cannot be unknown. It is configured to VRF_LITE by default in zebra anyway, so just init to VRF_LITE in the lib and remove the UNKNOWN type. Signed-off-by: Igor Ryzhov --- lib/if.c | 2 -- lib/vrf.c | 7 +------ lib/vrf.h | 1 - zebra/main.c | 2 -- 4 files changed, 1 insertion(+), 11 deletions(-) diff --git a/lib/if.c b/lib/if.c index 796929ef0d..68724a65e9 100644 --- a/lib/if.c +++ b/lib/if.c @@ -416,7 +416,6 @@ static struct interface *if_lookup_by_ifindex(ifindex_t ifindex, struct interface *if_lookup_by_index(ifindex_t ifindex, vrf_id_t vrf_id) { switch (vrf_get_backend()) { - case VRF_BACKEND_UNKNOWN: case VRF_BACKEND_NETNS: return(if_lookup_by_ifindex(ifindex, vrf_id)); case VRF_BACKEND_VRF_LITE: @@ -686,7 +685,6 @@ struct interface *if_get_by_name(const char *name, vrf_id_t vrf_id, struct vrf *vrf; switch (vrf_get_backend()) { - case VRF_BACKEND_UNKNOWN: case VRF_BACKEND_NETNS: vrf = vrf_get(vrf_id, vrf_name); assert(vrf); diff --git a/lib/vrf.c b/lib/vrf.c index 9be8a9faae..e576111163 100644 --- a/lib/vrf.c +++ b/lib/vrf.c @@ -42,8 +42,7 @@ RB_GENERATE(vrf_name_head, vrf, name_entry, vrf_name_compare); struct vrf_id_head vrfs_by_id = RB_INITIALIZER(&vrfs_by_id); struct vrf_name_head vrfs_by_name = RB_INITIALIZER(&vrfs_by_name); -static int vrf_backend; -static int vrf_backend_configured; +static int vrf_backend = VRF_BACKEND_VRF_LITE; static char vrf_default_name[VRF_NAMSIZ] = VRF_DEFAULT_NAME_INTERNAL; /* @@ -654,8 +653,6 @@ int vrf_is_backend_netns(void) int vrf_get_backend(void) { - if (!vrf_backend_configured) - return VRF_BACKEND_UNKNOWN; return vrf_backend; } @@ -663,7 +660,6 @@ int vrf_configure_backend(enum vrf_backend_type backend) { /* Work around issue in old gcc */ switch (backend) { - case VRF_BACKEND_UNKNOWN: case VRF_BACKEND_NETNS: case VRF_BACKEND_VRF_LITE: break; @@ -672,7 +668,6 @@ int vrf_configure_backend(enum vrf_backend_type backend) } vrf_backend = backend; - vrf_backend_configured = 1; return 0; } diff --git a/lib/vrf.h b/lib/vrf.h index ad302de9ba..46d72910c2 100644 --- a/lib/vrf.h +++ b/lib/vrf.h @@ -94,7 +94,6 @@ DECLARE_QOBJ_TYPE(vrf); enum vrf_backend_type { VRF_BACKEND_VRF_LITE, VRF_BACKEND_NETNS, - VRF_BACKEND_UNKNOWN, VRF_BACKEND_MAX, }; diff --git a/zebra/main.c b/zebra/main.c index d189d1e0a0..f84bfa6eb0 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -360,8 +360,6 @@ int main(int argc, char **argv) if_notify_oper_changes = true; vrf_notify_oper_changes = true; - vrf_configure_backend(VRF_BACKEND_VRF_LITE); - frr_preinit(&zebra_di, argc, argv); frr_opt_add("baz:e:rK:s:R:"