Skip to content

Commit

Permalink
lib: remove VRF_BACKEND_UNKNOWN
Browse files Browse the repository at this point in the history
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 <idryzhov@gmail.com>
  • Loading branch information
idryzhov committed Dec 26, 2024
1 parent 3f6c106 commit 59eefe5
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 11 deletions.
2 changes: 0 additions & 2 deletions lib/if.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,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:
Expand Down Expand Up @@ -573,7 +572,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);
Expand Down
7 changes: 1 addition & 6 deletions lib/vrf.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,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;

/*
Expand Down Expand Up @@ -612,16 +611,13 @@ int vrf_is_backend_netns(void)

int vrf_get_backend(void)
{
if (!vrf_backend_configured)
return VRF_BACKEND_UNKNOWN;
return vrf_backend;
}

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;
Expand All @@ -630,7 +626,6 @@ int vrf_configure_backend(enum vrf_backend_type backend)
}

vrf_backend = backend;
vrf_backend_configured = 1;

return 0;
}
Expand Down
1 change: 0 additions & 1 deletion lib/vrf.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ DECLARE_QOBJ_TYPE(vrf);
enum vrf_backend_type {
VRF_BACKEND_VRF_LITE,
VRF_BACKEND_NETNS,
VRF_BACKEND_UNKNOWN,
VRF_BACKEND_MAX,
};

Expand Down
2 changes: 0 additions & 2 deletions zebra/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,6 @@ int main(int argc, char **argv)

zserv_path = NULL;

vrf_configure_backend(VRF_BACKEND_VRF_LITE);

frr_preinit(&zebra_di, argc, argv);

frr_opt_add("baz:e:rK:s:R:"
Expand Down

0 comments on commit 59eefe5

Please sign in to comment.