summaryrefslogtreecommitdiff
path: root/ldpd/lde_lib.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2016-03-01 15:31:28 -0300
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-09-23 09:31:09 -0400
commiteac6e3f027356c25a8c8fddf921f769b79945fcc (patch)
tree69d5a17fb3f95934bafa22f8a3aee28c92780d62 /ldpd/lde_lib.c
parente30090a678e45aee2755c492212c5a478b9dcfcc (diff)
ldpd: adapt the code for Quagga
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ldpd/lde_lib.c')
-rw-r--r--ldpd/lde_lib.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/ldpd/lde_lib.c b/ldpd/lde_lib.c
index d9c1f544f1..568761bd61 100644
--- a/ldpd/lde_lib.c
+++ b/ldpd/lde_lib.c
@@ -17,17 +17,14 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netmpls/mpls.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
+#include <zebra.h>
#include "ldpd.h"
#include "lde.h"
#include "log.h"
+#include "mpls.h"
+
static __inline int fec_compare(struct fec *, struct fec *);
static int lde_nbr_is_nexthop(struct fec_node *,
struct lde_nbr *);
@@ -40,7 +37,7 @@ static void fec_nh_del(struct fec_nh *);
RB_GENERATE(fec_tree, fec, entry, fec_compare)
struct fec_tree ft = RB_INITIALIZER(&ft);
-struct event gc_timer;
+struct thread *gc_timer;
/* FEC tree functions */
void
@@ -165,6 +162,7 @@ rt_dump(pid_t pid)
LIST_EMPTY(&fn->downstream))
continue;
+ rtctl.first = 1;
switch (fn->fec.type) {
case FEC_TYPE_IPV4:
rtctl.af = AF_INET;
@@ -188,6 +186,7 @@ rt_dump(pid_t pid)
lde_imsg_compose_ldpe(IMSG_CTL_SHOW_LIB, 0, pid,
&rtctl, sizeof(rtctl));
+ rtctl.first = 0;
}
if (LIST_EMPTY(&fn->downstream)) {
rtctl.in_use = 0;
@@ -338,9 +337,6 @@ lde_kernel_insert(struct fec *fec, int af, union ldpd_addr *nexthop,
if (fec_nh_find(fn, af, nexthop, priority) != NULL)
return;
- log_debug("lde add fec %s nexthop %s",
- log_fec(&fn->fec), log_addr(af, nexthop));
-
if (fn->fec.type == FEC_TYPE_PWID)
fn->data = data;
@@ -396,9 +392,6 @@ lde_kernel_remove(struct fec *fec, int af, union ldpd_addr *nexthop,
/* route lost */
return;
- log_debug("lde remove fec %s nexthop %s",
- log_fec(&fn->fec), log_addr(af, nexthop));
-
lde_send_delete_klabel(fn, fnh);
fec_nh_del(fnh);
if (LIST_EMPTY(&fn->nexthops)) {
@@ -738,8 +731,8 @@ lde_check_withdraw_wcard(struct map *map, struct lde_nbr *ln)
/* gabage collector timer: timer to remove dead entries from the LIB */
/* ARGSUSED */
-void
-lde_gc_timer(int fd, short event, void *arg)
+int
+lde_gc_timer(struct thread *thread)
{
struct fec *fec, *safe;
struct fec_node *fn;
@@ -762,23 +755,20 @@ lde_gc_timer(int fd, short event, void *arg)
log_debug("%s: %u entries removed", __func__, count);
lde_gc_start_timer();
+
+ return (0);
}
void
lde_gc_start_timer(void)
{
- struct timeval tv;
-
- timerclear(&tv);
- tv.tv_sec = LDE_GC_INTERVAL;
- if (evtimer_add(&gc_timer, &tv) == -1)
- fatal(__func__);
+ THREAD_TIMER_OFF(gc_timer);
+ gc_timer = thread_add_timer(master, lde_gc_timer, NULL,
+ LDE_GC_INTERVAL);
}
void
lde_gc_stop_timer(void)
{
- if (evtimer_pending(&gc_timer, NULL) &&
- evtimer_del(&gc_timer) == -1)
- fatal(__func__);
+ THREAD_TIMER_OFF(gc_timer);
}