[syslinux] tftpd and broadcast

Geert Stappers stappers at stappers.nl
Wed Sep 6 14:49:51 PDT 2006


On Mon, Sep 04, 2006 at 09:47:19PM +0200, Geert Stappers wrote:
> On Mon, Sep 04, 2006 at 08:00:35PM +0200, Geert Stappers wrote:
> > On Mon, Sep 04, 2006 at 07:42:54PM +0200, Geert Stappers wrote:
> > > 
> > > Yes, it does reply to broadcasts, but fails on further follow-up.
> > > 
>  <snip/>
> > 
> > > 19:17:58.324688 IP 172.24.0.26 > 172.24.0.15: ICMP 172.24.0.26 udp port 33375 unreachable, length 40
> > TFTP server tells to TFTP client that he is not listing anymore ...
> > 
> 
> This is with a time-out of three seconds.
> 
> 
> 20:10:36.435213 IP 172.24.0.15.14841 > 255.255.255.255.69:  17 RRQ "AC18000F" octet 
> 20:10:45.437999 IP 172.24.0.26.33376 > 172.24.0.15.14841: UDP, length 516
> 20:10:46.501875 IP 172.24.0.15.14841 > 172.24.0.26.33376: UDP, length 4
> 20:10:46.501988 IP 172.24.0.26 > 172.24.0.15: ICMP 172.24.0.26 udp port 33376 unreachable, length 40
> 20:10:50.513489 IP 172.24.0.15.14841 > 172.24.0.26.33376: UDP, length 4
> 20:10:50.513539 IP 172.24.0.26 > 172.24.0.15: ICMP 172.24.0.26 udp port 33376 unreachable, length 40


With this patch

--- tftp-hpa-0.42/tftpd/tftpd.c	2006-02-16 18:45:22.000000000 +0100
+++ tftp-hpa-0.42-gst/tftpd/tftpd.c	2006-09-05 16:44:07.000000000 +0200
@@ -650,6 +650,12 @@
       memcpy(&myaddr.sin_addr, &bindaddr.sin_addr, sizeof bindaddr.sin_addr);
     }
 
+    if ( myaddr.sin_addr.s_addr == INADDR_BROADCAST ) {
+      syslog(LOG_INFO, "Broadcast request, binding to %s",
+	     inet_ntoa(bindaddr.sin_addr));
+      memcpy(&myaddr.sin_addr, &bindaddr.sin_addr, sizeof bindaddr.sin_addr);
+    }
+
     /*
      * Now that we have read the request packet from the UDP
      * socket, we fork and go back to listening to the socket.


I was able to install a Sparc doing TFTP boardcast request.

I'm parking that patch here. It needs more love, but I haddenn't
yesterday time for it, nor today and unlikely tomorrow.

Todo list:

* verify working of unicast request
* move the added code to "child"
* check with ethernet sniffer proper behaviour


See you friday or later ...
Geert Stappers




More information about the Syslinux mailing list