Hi,

I have the weird scenario when I try to tftp a file from a remote tftpd that's
also openbsd that my pf doesn't keep a state open.  This is something I need
to fix, however I found this in the logs on the remote tftpd and it's 
misleading:

Jun 28 14:03:21 hostname tftpd[2506]: recv: Connection refused

It first boggled my mind what it's trying to recv and then it came to me...
the write error message is delayed because of the ICMP port unreachable 
travel time at which point the descriptor is already blocking in read I guess.
So I have changed it to this:

Jun 28 14:03:21 hostname tftpd[2506]: sendfile: Connection refused

which to me is a lot more explanatory on what it fails on.  sendfile is
the function not the syscall.  I'd rather see send in there than recv.

Here is the patch:


Index: tftpd.c
===================================================================
RCS file: /cvs/src/libexec/tftpd/tftpd.c,v
retrieving revision 1.63
diff -u -r1.63 tftpd.c
--- tftpd.c     27 Oct 2009 23:59:32 -0000      1.63
+++ tftpd.c     28 Jun 2012 18:00:29 -0000
@@ -669,7 +669,10 @@
                                error = 1;
                                if (errno == EINTR)
                                        continue;
-                               syslog(LOG_ERR, "recv: %m");
+                               if (errno == ECONNREFUSED) 
+                                       syslog(LOG_ERR, "sendfile: %m");
+                               else
+                                       syslog(LOG_ERR, "recv: %m");
                                goto abort;
                        }
                        ap->th_opcode = ntohs((u_short)ap->th_opcode);



If you think kittens will die because of this patch then don't commit it
but otherwise I'm just trying to make sense of this better.

Cheers,

-peter

Reply via email to