Il 04/10/2010 11:34, Giovanni Mascellani ha scritto:
> The problem seems to stay in tftp_io.c, function tftp_send_data: the
> sendto call fails with errno = 56 (EISCONN). Don't know why under
> kFreeBSD the socket appears to be already connected, I'll investigate
> more in the next days.

FreeBSD doesn't like that an address is specified to sendto() data on a
connected socket, while Linux allows it. Thus, we have to disable the
call to connect() on FreeBSD. I'm attaching a patch for it, I intend to
NMU it on DELAYED/03.

Thanks, Gio.
-- 
Giovanni Mascellani <mascell...@poisson.phc.unipi.it>
Pisa, Italy

Web: http://poisson.phc.unipi.it/~mascellani
Jabber: g.mascell...@jabber.org / giova...@elabor.homelinux.org
diff -u atftp-0.7.dfsg/tftpd.c atftp-0.7.dfsg/tftpd.c
--- atftp-0.7.dfsg/tftpd.c
+++ atftp-0.7.dfsg/tftpd.c
@@ -673,6 +673,9 @@
                     retval = ABORT;
                }
                /* connect the socket, faster for kernel operation */
+               /* this is not a good idea on FreeBSD, because sendto() cannot
+                  be used on a connected datagram socket */
+#if !defined(__FreeBSD_kernel__)
                if (connect(data->sockfd,
                            (struct sockaddr *)&data->client_info->client,
                            sizeof(data->client_info->client)) == -1)
@@ -680,6 +683,7 @@
                     logger(LOG_ERR, "connect: %s", strerror(errno));
                     retval = ABORT;
                }
+#endif
                logger(LOG_DEBUG, "Creating new socket: %s:%d",
                       sockaddr_print_addr(&to, addr_str, sizeof(addr_str)),
                       sockaddr_get_port(&to));
diff -u atftp-0.7.dfsg/debian/changelog atftp-0.7.dfsg/debian/changelog
--- atftp-0.7.dfsg/debian/changelog
+++ atftp-0.7.dfsg/debian/changelog
@@ -1,3 +1,11 @@
+atftp (0.7.dfsg-9.2) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Fixed use of sendto() over a connected datagram socket on FreeBSD
+    (closes: #598474).
+
+ -- Giovanni Mascellani <g...@debian.org>  Mon, 04 Oct 2010 16:46:32 +0200
+
 atftp (0.7.dfsg-9.1) unstable; urgency=low
 
   * Non-maintainer upload.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to