Package: tftpd-hpa
Version: 0.40-4.1
Severity: wishlist

Hi,
a lot of broken firmwares out there (Siemens Nixdorf RM series, Digital
Decstations, most SGI Workstations) refuse to load by tftp if on the
tftp packets the DF (Dont Fragment) bit is set for path mtu discovery.
Most of the time PMTUd is not necessary as we boot on the local network.
Here is a small patch to let the tftpd disable path mtu discovery 
on the tftp socket if the OS has this option. 

In case the OS does not support switching path mtu discovery off per
socket it will log a warning if the users requests it to do so.


diff -Nur tftp-hpa-0.40/tftpd/tftpd.8.in tftp-hpa-0.40.nopmtu/tftpd/tftpd.8.in
--- tftp-hpa-0.40/tftpd/tftpd.8.in      2004-09-15 00:38:46.000000000 +0200
+++ tftp-hpa-0.40.nopmtu/tftpd/tftpd.8.in       2005-07-01 23:19:52.000000000 
+0200
@@ -150,6 +150,10 @@
 Indicate that a specific RFC 2347 TFTP option should never be
 accepted.
 .TP
+\fB\-F
+Disable PATH MTU Discovery This is needed for a couple of broken firmwares 
+e.g. Digital Decstations, Silicon Graphics and Siemens RM.
+.TP
 \fB\-B\fP \fImax-block-size\fP
 Specifies the maximum permitted block size.  The permitted range for
 this parameter is from 512 to 65464.  Some embedded clients request
diff -Nur tftp-hpa-0.40/tftpd/tftpd.c tftp-hpa-0.40.nopmtu/tftpd/tftpd.c
--- tftp-hpa-0.40/tftpd/tftpd.c 2004-09-15 00:38:46.000000000 +0200
+++ tftp-hpa-0.40.nopmtu/tftpd/tftpd.c  2005-07-01 23:21:13.000000000 +0200
@@ -106,6 +106,7 @@
 
 int    secure = 0;
 int    cancreate = 0;
+int    nopmtu = 0;
 int    unixperms = 0;
 
 int verbosity = 0;
@@ -293,8 +294,7 @@
   __progname = (p && p[1]) ? p+1 : argv[0];
   
   openlog(__progname, LOG_PID|LOG_NDELAY, LOG_DAEMON);
-  
-  while ((c = getopt(argc, argv, "cspvVla:B:u:U:r:t:T:m:")) != -1)
+  while ((c = getopt(argc, argv, "cFspvVla:B:u:U:r:t:T:m:")) != -1)
     switch (c) {
     case 'c':
       cancreate = 1;
@@ -302,6 +302,9 @@
     case 's':
       secure = 1;
       break;
+    case 'F':
+      nopmtu = 1;
+      break;
     case 'p':
       unixperms = 1;
       break;
@@ -641,6 +644,16 @@
     exit(EX_IOERR);
   }
 
+  if (nopmtu) {
+#ifdef IP_MTU_DISCOVER
+    int off=IP_PMTUDISC_DONT;
+    setsockopt(peer, IPPROTO_IP, IP_MTU_DISCOVER, &off, sizeof(off));
+#else
+    syslog(LOG_WARN, 
+       "system does not support setsockopt(... IP_MTU_DISCOVER ...)");
+#endif 
+  }
+
   /* Set up the supplementary group access list if possible */
   /* /etc/group still need to be accessible at this point */
 #ifdef HAVE_INITGROUPS

-- 
Florian Lohoff                  [EMAIL PROTECTED]             +49-171-2280134
                        Heisenberg may have been here.

Attachment: signature.asc
Description: Digital signature

Reply via email to