From dc438c8ec893be37c4cb1e59f377bf182b1d1a07 Mon Sep 17 00:00:00 2001 From: Craig Rodrigues Date: Wed, 15 Jun 2011 22:08:18 +0000 Subject: [PATCH] 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 --- lib/libstand/tftp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/libstand/tftp.c b/lib/libstand/tftp.c index 5cb876202e8..b8da31a55f4 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;