cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3129
Views
5
Helpful
7
Replies

Solaris tftp server (tftpd) to handle >32MB files

yjdabear
VIP Alumni
VIP Alumni

Assuming it's not legally allowed to separately install the Cisco tftpd shipped with LMS on a non-LMS server, can anyone verify the following Sun patches address the same >32MB file handling problem for the tftpd shipped with Solaris 10?

http://sunsolve.sun.com/search/document.do?assetkey=urn:cds:docid:1-21-123333-02-1

SPARC 123332

x86 123333

2 Accepted Solutions

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

It is completely legal to install the LMS TFTP server on a non-LMS server. We ship hpa-tftpd which is BSD-licensed open source code.

That said, it does look like this patch will also do the trick with Solaris' built-in in.tftpd.

View solution in original post

This is a bug. You need the attached patch to build on BSD-based operating systems like OS X.

Yes, you can install the tftpd from Solaris media, but it will only work on UltraSPARC Solaris.

View solution in original post

7 Replies 7

Joe Clarke
Cisco Employee
Cisco Employee

It is completely legal to install the LMS TFTP server on a non-LMS server. We ship hpa-tftpd which is BSD-licensed open source code.

That said, it does look like this patch will also do the trick with Solaris' built-in in.tftpd.

Awesome news (to me). Could you point to a link of the BSD-style license for the LMS tftpd? What other advantages does it have over Sun's tftpd?

The source code can be downloaded from ftp://ftp.kernel.org/pub/software/network/tftp/ . It contains a list of features and some other documentation.

Could it be installed off the LMS media though?

Just for kicks, I tried to build v5.0 on OS X (gcc 4.0.1 or 4.2.1). The "make" fails if IPv6 support is enabled:

tftpd.c: In function 'pmtu_discovery_off':

tftpd.c:194: warning: unused parameter 'fd'

gcc -g -O2 -W -Wall -Wpointer-arith -Wbad-function-cast -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Wwrite-strings -Wundef -Wshadow -Wsign-compare -pipe -fno-strict-aliasing -I/Users/myusername/tftp-hpa-5.0 -c recvfrom.c

recvfrom.c: In function 'myrecvfrom':

recvfrom.c:218: error: 'IPV6_RECVPKTINFO' undeclared (first use in this function)

recvfrom.c:218: error: (Each undeclared identifier is reported only once

recvfrom.c:218: error: for each function it appears in.)

make[1]: *** [recvfrom.o] Error 1

make: *** [tftpd.build] Error 2

This is a bug. You need the attached patch to build on BSD-based operating systems like OS X.

Yes, you can install the tftpd from Solaris media, but it will only work on UltraSPARC Solaris.

Thanks for the patch. That got it built. However, in.tftpd keeps crashing with 10 counts of "cannot bind to local IPv4 socket: Address already in use" whether I try put a file via IPv6 or IPv4. It was listening on both fine, prior to the put. I'm using the "system daemon" launchd plist adapted directly from Apple's own.

Never mind, it's resolved by taking out the -l option.

Interestingly, /tftpboot (/private/tftpboot) is not even group- and world-writable.

Update: In order to compile tftp-hpa (up to 5.2.0) on Mac OS X 10.7.3 (Lion) with IPv6, ./tftpd/recvfrom.c needs a little extra header definition. Below is the updated patch (generated with "diff -rupN tftpd/recvfrom.c.orig tftpd/recvfrom.c > tftpd/recvfrom.c.diff", and apply through "patch -p0 < tftpd/recvfrom.c.diff" from the root of tftp-hpa source code directory).

--- tftpd/recvfrom.c.orig    2011-12-11 14:13:52.000000000 -0800

+++ tftpd/recvfrom.c    2012-03-01 22:58:36.000000000 -0800

@@ -17,6 +17,12 @@

  *

  */

+#if defined(__APPLE__)

+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1070

+#define __APPLE_USE_RFC_3542 1

+#endif

+#endif

+

#include "config.h"             /* Must be included first! */

#include "common/tftpsubs.h"

#include "recvfrom.h"

@@ -222,7 +228,11 @@ myrecvfrom(int s, void *buf, int len, un

#ifdef HAVE_STRUCT_IN6_PKTINFO

                 if (cmptr->cmsg_level == IPPROTO_IPV6 &&

+#ifdef IPV6_RECVPKTINFO

                     (cmptr->cmsg_type == IPV6_RECVPKTINFO ||

+#else

+             (

+#endif

                      cmptr->cmsg_type == IPV6_PKTINFO)) {

                     memcpy(&pktinfo6, CMSG_DATA(cmptr),

                            sizeof(struct in6_pktinfo));


Then simply

# ./configure --with-ipv6

# make

# sudo make install

To test

# chmod 777 /path/to/tftpboot

# sudo /usr/local/sbin/in.tftpd -L -c -s /path/to/tftpboot

# nettop -n

in.tftpd.66083                                                                             0           0 B

    udp6 *.69<->*.*                                                                        0           0 B

    udp4 *:69<->*:*                                                                        0           0 B

OR stick it in a launchd plist, but make sure it doesn't daemonize by leaving out the "-L" flag.

http://www.apple.com/DTDs/PropertyList-1.0.dtd">

    InitGroups

   

    Label

    org.kernel.tftpd

    ProgramArguments

   

        /usr/local/sbin/in.tftpd

        -c

        -s

        /private/tftpboot

   

    Sockets

   

        Listeners

       

            SockServiceName

            tftp

            SockType

            dgram

       

   

    inetdCompatibility

   

        Wait

       

   

Review Cisco Networking for a $25 gift card