From: Michael Brown Date: Wed, 14 Oct 2020 13:52:13 +0000 (+0100) Subject: [ipv6] Reduce time spent waiting for router discovery X-Git-Tag: v1.21.1~77 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ccd5239b13ca92800ea81c2d6489e0ad8e9d5e6;p=thirdparty%2Fipxe.git [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 --- 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 #include #include +#include #include /** @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 */