summaryrefslogtreecommitdiffstats
path: root/lib/libstand
diff options
context:
space:
mode:
authorrodrigc <rodrigc@FreeBSD.org>2011-06-15 22:08:18 +0000
committerrodrigc <rodrigc@FreeBSD.org>2011-06-15 22:08:18 +0000
commit62ae73089f3deb0888395da5a9f0c6f1e1c4b811 (patch)
tree7a2ffef9e79f1d468f4833cb8f95b7787ac2053d /lib/libstand
parentd05f25ce84fa1850102baa6610eb2566f980b41c (diff)
downloadFreeBSD-src-62ae73089f3deb0888395da5a9f0c6f1e1c4b811.zip
FreeBSD-src-62ae73089f3deb0888395da5a9f0c6f1e1c4b811.tar.gz
Currently tftp code in the loader retransmits the previous packet if it receives any
unwanted packet(non-tftp). Change this to retransmit the packet(request or ack) only after a timeout. Obtained from: Juniper Networks Fixed by: Santhanakrishnan Balraj <sbalraj at juniper dot net>
Diffstat (limited to 'lib/libstand')
-rw-r--r--lib/libstand/tftp.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libstand/tftp.c b/lib/libstand/tftp.c
index 5cb8762..b8da31a 100644
--- a/lib/libstand/tftp.c
+++ b/lib/libstand/tftp.c
@@ -443,11 +443,15 @@ sendrecv_tftp(d, sproc, sbuf, ssize, rproc, rbuf, rsize)
continue;
}
+recvnext:
/* Try to get a packet and process it. */
cc = (*rproc)(d, rbuf, rsize, tleft);
/* Return on data, EOF or real error. */
if (cc != -1 || errno != 0)
return (cc);
+ if ((getsecs() - t1) < tleft) {
+ goto recvnext;
+ }
/* Timed out or didn't get the packet we're waiting for */
tleft += MINTMO;
OpenPOWER on IntegriCloud