summaryrefslogtreecommitdiff
path: root/core/fs/pxe/dnsresolv.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-06-21 10:11:59 -0700
committerH. Peter Anvin <hpa@zytor.com>2010-06-21 10:11:59 -0700
commit14b77079a892dc42219217688684ed9d6c4d0e3d (patch)
tree410bb7c4db30bb4ec135978f1c22e9f489c8cce6 /core/fs/pxe/dnsresolv.c
parent4e7d836b8cdc0e785ac6e0a78b258c4e193d2222 (diff)
downloadsyslinux-14b77079a892dc42219217688684ed9d6c4d0e3d.tar.gz
dns: don't get stuck on no packet receivedsyslinux-4.00-pre54
Make sure the timeout actually gets processed. The right thing to do for the receive loop is to check for timeout, then try to receive, and loop until an acceptable packet has been received; we might as well do that explicitly. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'core/fs/pxe/dnsresolv.c')
-rw-r--r--core/fs/pxe/dnsresolv.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/core/fs/pxe/dnsresolv.c b/core/fs/pxe/dnsresolv.c
index 76a905a2..2b263fad 100644
--- a/core/fs/pxe/dnsresolv.c
+++ b/core/fs/pxe/dnsresolv.c
@@ -247,7 +247,10 @@ uint32_t dns_resolv(const char *name)
continue;
oldtime = jiffies();
- while (1) {
+ do {
+ if (jiffies() - oldtime >= timeout)
+ goto again;
+
udp_read.status = 0;
udp_read.src_ip = srv;
udp_read.dest_ip = IPInfo.myip;
@@ -256,16 +259,8 @@ uint32_t dns_resolv(const char *name)
udp_read.buffer_size = PKTBUF_SIZE;
udp_read.buffer = FAR_PTR(DNSRecvBuf);
err = pxe_call(PXENV_UDP_READ, &udp_read);
- if (err || udp_read.status)
- continue;
-
- /* Got a packet, deal with it... */
- if (hd2->id == hd1->id)
- break;
+ } while (err || udp_read.status || hd2->id != hd1->id);
- if (jiffies() - oldtime >= timeout)
- goto again;
- }
if ((hd2->flags ^ 0x80) & htons(0xf80f))
goto badness;