]> git.proxmox.com Git - mirror_frr.git/blobdiff - ldpd/adjacency.c
Merge pull request #5259 from mjstapp/dplane_sample_plugin
[mirror_frr.git] / ldpd / adjacency.c
index 89314aa2c3e9f498a6afe85d8f91166d5fd9df1c..0bdd2423c7c1b47a7975ca0d44f17612d216fc6c 100644 (file)
@@ -25,9 +25,9 @@
 #include "ldpe.h"
 #include "log.h"
 
-static __inline int adj_compare(struct adj *, struct adj *);
+static __inline int adj_compare(const struct adj *, const struct adj *);
 static int      adj_itimer(struct thread *);
-static __inline int tnbr_compare(struct tnbr *, struct tnbr *);
+static __inline int tnbr_compare(const struct tnbr *, const struct tnbr *);
 static void     tnbr_del(struct ldpd_conf *, struct tnbr *);
 static void     tnbr_start(struct tnbr *);
 static void     tnbr_stop(struct tnbr *);
@@ -41,7 +41,7 @@ RB_GENERATE(ia_adj_head, adj, ia_entry, adj_compare)
 RB_GENERATE(tnbr_head, tnbr, entry, tnbr_compare)
 
 static __inline int
-adj_compare(struct adj *a, struct adj *b)
+adj_compare(const struct adj *a, const struct adj *b)
 {
        if (adj_get_af(a) < adj_get_af(b))
                return (-1);
@@ -60,11 +60,11 @@ adj_compare(struct adj *a, struct adj *b)
 
        switch (a->source.type) {
        case HELLO_LINK:
-               if (strcmp(a->source.link.ia->iface->name,
-                   b->source.link.ia->iface->name) < 0)
+               if (if_cmp_name_func(a->source.link.ia->iface->name,
+                                    b->source.link.ia->iface->name) < 0)
                        return (-1);
-               if (strcmp(a->source.link.ia->iface->name,
-                   b->source.link.ia->iface->name) > 0)
+               if (if_cmp_name_func(a->source.link.ia->iface->name,
+                                    b->source.link.ia->iface->name) > 0)
                        return (1);
                return (ldp_addrcmp(a->source.link.ia->af,
                    &a->source.link.src_addr, &b->source.link.src_addr));
@@ -154,7 +154,7 @@ adj_find(struct in_addr lsr_id, struct hello_source *source)
 }
 
 int
-adj_get_af(struct adj *adj)
+adj_get_af(const struct adj *adj)
 {
        switch (adj->source.type) {
        case HELLO_LINK:
@@ -196,8 +196,9 @@ void
 adj_start_itimer(struct adj *adj)
 {
        THREAD_TIMER_OFF(adj->inactivity_timer);
-       adj->inactivity_timer = thread_add_timer(master, adj_itimer, adj,
-           adj->holdtime);
+       adj->inactivity_timer = NULL;
+       thread_add_timer(master, adj_itimer, adj, adj->holdtime,
+                        &adj->inactivity_timer);
 }
 
 void
@@ -209,7 +210,7 @@ adj_stop_itimer(struct adj *adj)
 /* targeted neighbors */
 
 static __inline int
-tnbr_compare(struct tnbr *a, struct tnbr *b)
+tnbr_compare(const struct tnbr *a, const struct tnbr *b)
 {
        if (a->af < b->af)
                return (-1);
@@ -356,8 +357,9 @@ static void
 tnbr_start_hello_timer(struct tnbr *tnbr)
 {
        THREAD_TIMER_OFF(tnbr->hello_timer);
-       tnbr->hello_timer = thread_add_timer(master, tnbr_hello_timer, tnbr,
-           tnbr_get_hello_interval(tnbr));
+       tnbr->hello_timer = NULL;
+       thread_add_timer(master, tnbr_hello_timer, tnbr, tnbr_get_hello_interval(tnbr),
+                        &tnbr->hello_timer);
 }
 
 static void