summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ospfd/interface.c
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2010-02-16 08:39:05 +0000
committerdlg <dlg@openbsd.org>2010-02-16 08:39:05 +0000
commit7afdfd2dfa39cfe53336ddae9f26473ba4897e87 (patch)
treeb067791e8327ff3842c70b490a26e0c216cf75d9 /usr.sbin/ospfd/interface.c
parentdefault verbosity to 4 (diff)
downloadwireguard-openbsd-7afdfd2dfa39cfe53336ddae9f26473ba4897e87.tar.xz
wireguard-openbsd-7afdfd2dfa39cfe53336ddae9f26473ba4897e87.zip
implement support for fast hello packets.
if route-dead-time is set to "minimal" (rather than a number of seconds), the dead time is set to 1 second and hellos are sent at the interval specified by fast-hello-interval in msecs. this is non standard wrt to the ospf rfc, but it does interoperate with at least one other router vendor. this allows much better responsiveness to l3 topology changes than the standard intervals allow. if i yank a cable to one of my upstreams, the routes adjust in a second rather than the default of 40 i was running with before. the users dont even notice something changed. developed while working with joshua atterbury. ok claudio@ as part of a larger diff. dedicated to zan rowe who thinks she is a bigger nerd than me.
Diffstat (limited to 'usr.sbin/ospfd/interface.c')
-rw-r--r--usr.sbin/ospfd/interface.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/usr.sbin/ospfd/interface.c b/usr.sbin/ospfd/interface.c
index a5d53ab9b0a..92a9e6f1ee2 100644
--- a/usr.sbin/ospfd/interface.c
+++ b/usr.sbin/ospfd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.66 2009/09/30 14:39:07 claudio Exp $ */
+/* $OpenBSD: interface.c,v 1.67 2010/02/16 08:39:05 dlg Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -278,7 +278,10 @@ if_hello_timer(int fd, short event, void *arg)
/* reschedule hello_timer */
timerclear(&tv);
- tv.tv_sec = iface->hello_interval;
+ if (iface->dead_interval == FAST_RTR_DEAD_TIME)
+ tv.tv_usec = iface->fast_hello_interval * 1000;
+ else
+ tv.tv_sec = iface->hello_interval;
if (evtimer_add(&iface->hello_timer, &tv) == -1)
fatal("if_hello_timer");
}
@@ -629,6 +632,7 @@ if_to_ctl(struct iface *iface)
ictl.adj_cnt = 0;
ictl.baudrate = iface->baudrate;
ictl.dead_interval = iface->dead_interval;
+ ictl.fast_hello_interval = iface->fast_hello_interval;
ictl.transmit_delay = iface->transmit_delay;
ictl.hello_interval = iface->hello_interval;
ictl.flags = iface->flags;
@@ -645,9 +649,10 @@ if_to_ctl(struct iface *iface)
gettimeofday(&now, NULL);
if (evtimer_pending(&iface->hello_timer, &tv)) {
timersub(&tv, &now, &res);
- ictl.hello_timer = res.tv_sec;
- } else
- ictl.hello_timer = -1;
+ ictl.hello_timer = res;
+ } else {
+ ictl.hello_timer.tv_sec = -1;
+ }
if (iface->state != IF_STA_DOWN) {
ictl.uptime = now.tv_sec - iface->uptime;