Package: tftpd
Version: 0.17-15
Severity: wishlist
If the client is too slow (eg embedded systems), tftp might not bei
able to deliver the data and receive a "tftpd: write: Connection refused".
The patch below makes tftpd retry 3 times when a paket couldn't be send
with a delay of 1ms.
--- tftpd.c.old 2000-07-29 20:37:21.000000000 +0200
+++ tftpd.c 2007-07-17 09:56:17.000000000 +0200
@@ -401,6 +437,7 @@
register struct tftphdr *ap; /* ack packet */
volatile u_int16_t block = 1;
int size, n;
+ int retry_cnt, ret;
mysignal(SIGALRM, timer);
dp = r_init();
@@ -417,7 +454,14 @@
(void) sigsetjmp(timeoutbuf, 1);
send_data:
- if (send(peer, dp, size + 4, 0) != size + 4) {
+ retry_cnt = 0;
+ ret = 0;
+ while(retry_cnt <3 && ret != size + 4){
+ ret = send(peer, dp, size + 4, 0);
+ if(ret != size + 4)
+ usleep(1000); /* sleep 1ms */
+ }
+ if (ret != size + 4) {
syslog(LOG_ERR, "tftpd: write: %m\n");
goto abort;
}
@@ -473,6 +517,7 @@
struct tftphdr *ap; /* ack buffer */
volatile u_int16_t block = 0;
int n, size;
+ int retry_cnt, ret;
mysignal(SIGALRM, timer);
dp = w_init();
@@ -484,7 +531,14 @@
block++;
(void) sigsetjmp(timeoutbuf, 1);
send_ack:
- if (send(peer, ackbuf, 4, 0) != 4) {
+ retry_cnt = 0;
+ ret = 0;
+ while(retry_cnt <3 && ret != size + 4){
+ ret = send(peer, dp, size + 4, 0);
+ if(ret != size + 4)
+ usleep(1000); /* sleep 1ms */
+ }
+ if (ret != size + 4) {
syslog(LOG_ERR, "tftpd: write: %m\n");
goto abort;
}
-- System Information:
Debian Release: lenny/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.21.5
Locale: LANG=de_CH.ISO-8859-1, LC_CTYPE=de_CH.ISO-8859-1 (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash
Versions of packages tftpd depends on:
ii libc6 2.5-9+b1 GNU C Library: Shared libraries
ii netbase 4.29 Basic TCP/IP networking system
tftpd recommends no packages.
-- no debconf information
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]