]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: expose comparision function to allow a typesafe conversion
authorDonald Sharp <sharpd@nvidia.com>
Mon, 24 Mar 2025 01:17:53 +0000 (21:17 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Mon, 24 Mar 2025 15:00:45 +0000 (11:00 -0400)
The interface hash comparison function is needed in eigrpd.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
lib/if.c
lib/if.h

index 68724a65e9e95a6e53ff7520543be61d0e5cb79e..43e3363b349273f811fda1ec004ebc5270c0dcd5 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -44,7 +44,6 @@ static void if_set_name(struct interface *ifp, const char *name);
 static struct interface *if_lookup_by_ifindex(ifindex_t ifindex,
                                              vrf_id_t vrf_id);
 static struct interface *if_lookup_by_index_all_vrf(ifindex_t ifindex);
-static int if_cmp_func(const struct interface *, const struct interface *);
 static int if_cmp_index_func(const struct interface *ifp1,
                             const struct interface *ifp2);
 RB_GENERATE(if_name_head, interface, name_entry, if_cmp_func);
@@ -136,8 +135,7 @@ int if_cmp_name_func(const char *p1, const char *p2)
        return 0;
 }
 
-static int if_cmp_func(const struct interface *ifp1,
-                      const struct interface *ifp2)
+int if_cmp_func(const struct interface *ifp1, const struct interface *ifp2)
 {
        return if_cmp_name_func(ifp1->name, ifp2->name);
 }
index 897f2be2398bf2d35b3b41710d276941212a98e5..fce6705c237de0b8272c99913b3c6db1b6a917e9 100644 (file)
--- a/lib/if.h
+++ b/lib/if.h
@@ -309,6 +309,8 @@ struct interface {
        QOBJ_FIELDS;
 };
 
+extern int if_cmp_func(const struct interface *a, const struct interface *b);
+
 RB_HEAD(if_name_head, interface);
 RB_PROTOTYPE(if_name_head, interface, name_entry, if_cmp_func)
 RB_HEAD(if_index_head, interface);