<div dir="ltr">For what it is worth, if I remember I plan to pull this into the xNBA repository when I next merge (I think that'll be tomorrow). I second that this is an issue in a lot of poorly configured environments. Surprised to see *VMs* so badly afflicted, but switch timeouts with block-by-default spanning tree frequently are fatal to iPXE as-is.</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Feb 17, 2014 at 4:20 PM, Alex Williamson <span dir="ltr"><<a href="mailto:alex.williamson@redhat.com" target="_blank">alex.williamson@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">For discovery, both the DHCP and PXE specs suggest timeouts of 4, 8,<br>
16, and 32 seconds. This gives us a maximum timeout of 60 seconds,<br>
versus the current timeout of 15 seconds at timeouts of 1, 2, 4, and<br>
8 seconds.<br>
<br>
On the request phase, the specs are quite different. RFC2131 for DHCP<br>
suggests the same intervals as above for discovery, while the PXE spec<br>
recommends intervals of 1, 2, 3, and 4 seconds. Our timer only wants<br>
to do exponential back-off, so we compromise and adjust to intervals<br>
of 1, 2, 4, and 8 seconds. PXE boot server discovery appears to want<br>
the same timeouts as the DHCP request phase.<br>
<br>
Signed-off-by: Alex Williamson <<a href="mailto:alex.williamson@redhat.com">alex.williamson@redhat.com</a>><br>
---<br>
<br>
I posted this previously[1] and prior to that also sent a question to<br>
the list asking why iPXE uses the non-spec compliant DHCP timeouts<br>
that it does[2]. There was some support for this patch[3], but it was<br>
never commited. My ping a couple weeks later also came up short[4].<br>
We do have customers complaining about this and unable to reliably<br>
boot virtual machines over their production network due to these short<br>
timeouts. Could we consider a patch like below, or any sort of<br>
re-implementation of it, to make iPXE DHCP behave more in accordance<br>
with spec defined timeouts? Thanks<br>
<br>
[1] <a href="http://lists.ipxe.org/pipermail/ipxe-devel/2013-June/002573.html" target="_blank">http://lists.ipxe.org/pipermail/ipxe-devel/2013-June/002573.html</a><br>
[2] <a href="http://lists.ipxe.org/pipermail/ipxe-devel/2013-June/002562.html" target="_blank">http://lists.ipxe.org/pipermail/ipxe-devel/2013-June/002562.html</a><br>
[3] <a href="http://lists.ipxe.org/pipermail/ipxe-devel/2013-June/002576.html" target="_blank">http://lists.ipxe.org/pipermail/ipxe-devel/2013-June/002576.html</a><br>
[4] <a href="http://lists.ipxe.org/pipermail/ipxe-devel/2013-June/002610.html" target="_blank">http://lists.ipxe.org/pipermail/ipxe-devel/2013-June/002610.html</a><br>
<br>
src/include/ipxe/dhcp.h | 4 ----<br>
src/net/udp/dhcp.c | 22 +++++++++++++---------<br>
2 files changed, 13 insertions(+), 13 deletions(-)<br>
<br>
diff --git a/src/include/ipxe/dhcp.h b/src/include/ipxe/dhcp.h<br>
index bcfb85c..595f0c1 100644<br>
--- a/src/include/ipxe/dhcp.h<br>
+++ b/src/include/ipxe/dhcp.h<br>
@@ -639,10 +639,6 @@ struct dhcphdr {<br>
*/<br>
#define DHCP_MIN_LEN 552<br>
<br>
-/** Timeouts for sending DHCP packets */<br>
-#define DHCP_MIN_TIMEOUT ( 1 * TICKS_PER_SEC )<br>
-#define DHCP_MAX_TIMEOUT ( 10 * TICKS_PER_SEC )<br>
-<br>
/** Maximum time that we will wait for ProxyDHCP responses */<br>
#define PROXYDHCP_MAX_TIMEOUT ( 2 * TICKS_PER_SEC )<br>
<br>
diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c<br>
index e6d3edd..87c8d6e 100644<br>
--- a/src/net/udp/dhcp.c<br>
+++ b/src/net/udp/dhcp.c<br>
@@ -171,8 +171,9 @@ struct dhcp_session_state {<br>
void ( * expired ) ( struct dhcp_session *dhcp );<br>
/** Transmitted message type */<br>
uint8_t tx_msgtype;<br>
- /** Apply minimum timeout */<br>
- uint8_t apply_min_timeout;<br>
+ /** Timer parameters (seconds) */<br>
+ unsigned long min_timeout;<br>
+ unsigned long max_timeout;<br>
};<br>
<br>
static struct dhcp_session_state dhcp_state_discover;<br>
@@ -272,9 +273,8 @@ static void dhcp_set_state ( struct dhcp_session *dhcp,<br>
dhcp->state = state;<br>
dhcp->start = currticks();<br>
stop_timer ( &dhcp->timer );<br>
- dhcp->timer.min_timeout =<br>
- ( state->apply_min_timeout ? DHCP_MIN_TIMEOUT : 0 );<br>
- dhcp->timer.max_timeout = DHCP_MAX_TIMEOUT;<br>
+ dhcp->timer.min_timeout = state->min_timeout * TICKS_PER_SEC;<br>
+ dhcp->timer.max_timeout = state->max_timeout * TICKS_PER_SEC;<br>
start_timer_nodelay ( &dhcp->timer );<br>
}<br>
<br>
@@ -447,7 +447,8 @@ static struct dhcp_session_state dhcp_state_discover = {<br>
.rx = dhcp_discovery_rx,<br>
.expired = dhcp_discovery_expired,<br>
.tx_msgtype = DHCPDISCOVER,<br>
- .apply_min_timeout = 1,<br>
+ .min_timeout = 4,<br>
+ .max_timeout = 32,<br>
};<br>
<br>
/**<br>
@@ -584,7 +585,8 @@ static struct dhcp_session_state dhcp_state_request = {<br>
.rx = dhcp_request_rx,<br>
.expired = dhcp_request_expired,<br>
.tx_msgtype = DHCPREQUEST,<br>
- .apply_min_timeout = 0,<br>
+ .min_timeout = 1,<br>
+ .max_timeout = 8,<br>
};<br>
<br>
/**<br>
@@ -685,7 +687,8 @@ static struct dhcp_session_state dhcp_state_proxy = {<br>
.rx = dhcp_proxy_rx,<br>
.expired = dhcp_proxy_expired,<br>
.tx_msgtype = DHCPREQUEST,<br>
- .apply_min_timeout = 0,<br>
+ .min_timeout = 1,<br>
+ .max_timeout = 8,<br>
};<br>
<br>
/**<br>
@@ -832,7 +835,8 @@ static struct dhcp_session_state dhcp_state_pxebs = {<br>
.rx = dhcp_pxebs_rx,<br>
.expired = dhcp_pxebs_expired,<br>
.tx_msgtype = DHCPREQUEST,<br>
- .apply_min_timeout = 1,<br>
+ .min_timeout = 1,<br>
+ .max_timeout = 8,<br>
};<br>
<br>
/****************************************************************************<br>
<br>
_______________________________________________<br>
ipxe-devel mailing list<br>
<a href="mailto:ipxe-devel@lists.ipxe.org">ipxe-devel@lists.ipxe.org</a><br>
<a href="https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel" target="_blank">https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel</a><br>
</blockquote></div><br></div>