summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ldpd/adjacency.c16
-rw-r--r--usr.sbin/ldpd/interface.c18
-rw-r--r--usr.sbin/ldpd/neighbor.c15
3 files changed, 13 insertions, 36 deletions
diff --git a/usr.sbin/ldpd/adjacency.c b/usr.sbin/ldpd/adjacency.c
index f8df2cecffa..4bcf9d884fc 100644
--- a/usr.sbin/ldpd/adjacency.c
+++ b/usr.sbin/ldpd/adjacency.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adjacency.c,v 1.9 2016/05/23 15:47:24 renato Exp $ */
+/* $OpenBSD: adjacency.c,v 1.10 2016/05/23 15:57:50 renato Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -229,24 +229,16 @@ tnbr_init(struct ldpd_conf *xconf, struct tnbr *tnbr)
void
tnbr_hello_timer(int fd, short event, void *arg)
{
- struct tnbr *tnbr = arg;
- struct timeval tv;
+ struct tnbr *tnbr = arg;
send_hello(HELLO_TARGETED, NULL, tnbr);
-
- /* reschedule hello_timer */
- timerclear(&tv);
- tv.tv_sec = tnbr->hello_interval;
- if (evtimer_add(&tnbr->hello_timer, &tv) == -1)
- fatal(__func__);
+ tnbr_start_hello_timer(tnbr);
}
void
tnbr_start_hello_timer(struct tnbr *tnbr)
{
- struct timeval tv;
-
- send_hello(HELLO_TARGETED, NULL, tnbr);
+ struct timeval tv;
timerclear(&tv);
tv.tv_sec = tnbr->hello_interval;
diff --git a/usr.sbin/ldpd/interface.c b/usr.sbin/ldpd/interface.c
index 4aec67a8973..a5d467976c6 100644
--- a/usr.sbin/ldpd/interface.c
+++ b/usr.sbin/ldpd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.29 2016/05/23 15:49:31 renato Exp $ */
+/* $OpenBSD: interface.c,v 1.30 2016/05/23 15:57:50 renato Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -216,7 +216,7 @@ if_start(struct iface *iface)
if (if_join_group(iface, &addr))
return (-1);
- /* hello timer needs to be started in any case */
+ send_hello(HELLO_LINK, iface, NULL);
if_start_hello_timer(iface);
return (0);
}
@@ -274,24 +274,16 @@ if_update(struct iface *iface)
void
if_hello_timer(int fd, short event, void *arg)
{
- struct iface *iface = arg;
- struct timeval tv;
+ struct iface *iface = arg;
send_hello(HELLO_LINK, iface, NULL);
-
- /* reschedule hello_timer */
- timerclear(&tv);
- tv.tv_sec = iface->hello_interval;
- if (evtimer_add(&iface->hello_timer, &tv) == -1)
- fatal(__func__);
+ if_start_hello_timer(iface);
}
void
if_start_hello_timer(struct iface *iface)
{
- struct timeval tv;
-
- send_hello(HELLO_LINK, iface, NULL);
+ struct timeval tv;
timerclear(&tv);
tv.tv_sec = iface->hello_interval;
diff --git a/usr.sbin/ldpd/neighbor.c b/usr.sbin/ldpd/neighbor.c
index d031f5de3bb..566cefc57bb 100644
--- a/usr.sbin/ldpd/neighbor.c
+++ b/usr.sbin/ldpd/neighbor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: neighbor.c,v 1.57 2016/05/23 15:49:31 renato Exp $ */
+/* $OpenBSD: neighbor.c,v 1.58 2016/05/23 15:57:50 renato Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -320,26 +320,19 @@ void
nbr_ktimer(int fd, short event, void *arg)
{
struct nbr *nbr = arg;
- struct timeval tv;
send_keepalive(nbr);
-
- timerclear(&tv);
- tv.tv_sec = (time_t)(nbr->keepalive / KEEPALIVE_PER_PERIOD);
- if (evtimer_add(&nbr->keepalive_timer, &tv) == -1)
- fatal(__func__);
+ nbr_start_ktimer(nbr);
}
void
nbr_start_ktimer(struct nbr *nbr)
{
- struct timeval tv;
+ struct timeval tv;
+ /* send three keepalives per period */
timerclear(&tv);
-
- /* XXX: just to be sure it will send three keepalives per period */
tv.tv_sec = (time_t)(nbr->keepalive / KEEPALIVE_PER_PERIOD);
-
if (evtimer_add(&nbr->keepalive_timer, &tv) == -1)
fatal(__func__);
}