aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2020-10-14 14:52:13 +0100
committerMichael Brown <mcb30@ipxe.org>2020-10-14 14:57:27 +0100
commit6ccd5239b13ca92800ea81c2d6489e0ad8e9d5e6 (patch)
tree6ea57d99c8a95755e2bdb6a55f7a8083fd1e16c6 /src
parent0c25daad38b2b345fbe6c4838ea2d9c82cc08228 (diff)
downloadipxe-6ccd5239b13ca92800ea81c2d6489e0ad8e9d5e6.tar.gz
[ipv6] Reduce time spent waiting for router discovery
Now that IPv6 is enabled by default for UEFI builds, it is important that iPXE does not delay unnecessarily in the (still relatively common) case of a network that lacks IPv6 routers. Apply the timeout values used for neighbour discovery to the router discovery process. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src')
-rw-r--r--src/net/ndp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/net/ndp.c b/src/net/ndp.c
index f28e71cbd..241af68de 100644
--- a/src/net/ndp.c
+++ b/src/net/ndp.c
@@ -31,6 +31,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/icmpv6.h>
#include <ipxe/neighbour.h>
#include <ipxe/dhcpv6.h>
+#include <ipxe/timer.h>
#include <ipxe/ndp.h>
/** @file
@@ -39,6 +40,12 @@ FILE_LICENCE ( GPL2_OR_LATER );
*
*/
+/** Router discovery minimum timeout */
+#define IPV6CONF_MIN_TIMEOUT ( TICKS_PER_SEC / 8 )
+
+/** Router discovery maximum timeout */
+#define IPV6CONF_MAX_TIMEOUT ( TICKS_PER_SEC * 3 )
+
static struct ipv6conf * ipv6conf_demux ( struct net_device *netdev );
static int
ipv6conf_rx_router_advertisement ( struct net_device *netdev,
@@ -1235,6 +1242,8 @@ int start_ipv6conf ( struct interface *job, struct net_device *netdev ) {
intf_init ( &ipv6conf->job, &ipv6conf_job_desc, &ipv6conf->refcnt );
intf_init ( &ipv6conf->dhcp, &ipv6conf_dhcp_desc, &ipv6conf->refcnt );
timer_init ( &ipv6conf->timer, ipv6conf_expired, &ipv6conf->refcnt );
+ set_timer_limits ( &ipv6conf->timer, IPV6CONF_MIN_TIMEOUT,
+ IPV6CONF_MAX_TIMEOUT );
ipv6conf->netdev = netdev_get ( netdev );
/* Start timer to initiate router solicitation */