]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[ipv6] Reduce time spent waiting for router discovery
authorMichael Brown <mcb30@ipxe.org>
Wed, 14 Oct 2020 13:52:13 +0000 (14:52 +0100)
committerMichael Brown <mcb30@ipxe.org>
Wed, 14 Oct 2020 13:57:27 +0000 (14:57 +0100)
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>
src/net/ndp.c

index f28e71cbde1564c8ef8cce227b0f47e96fffa374..241af68dee636b0d8462de951723c109201b7be6 100644 (file)
@@ -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 */