[En-Nut-Discussion] patch to make traceroute work properly

Dave ethernut at wormfood.org
Thu May 26 13:05:57 CEST 2005


Hi everyone,

I found this bug, by trying to use 'traceroute' to contact my ethernut
board. I never got a response from the ethernut board. This may make
troubleshooting network problems tricky, so I decided to try to fix it.
And it appears that my patch works without any ill effects. Of course I
used a network protocol analyzer (Ethereal) to check out everything,
before and after my patch, and I compared it to a working system.

I would think this patch would be included in the official version, if I
didn't screw up anything. Please look it over, and let me know.

-Dave


diff -ru old/net/udpin.c new/net/udpin.c
--- old/net/udpin.c 2005-02-02 19:04:32.000000000 -0500
+++ new/net/udpin.c 2005-05-26 06:13:30.870850008 -0400
@@ -113,6 +113,8 @@

 #include <sys/event.h>

+#include <netinet/ip_icmp.h>
+#include <netinet/icmp.h>
 #include <netinet/udp.h>
 #include <sys/socket.h>

@@ -146,6 +148,7 @@
      * Find a port. If none exists, return an ICMP unreachable.
      */
     if ((sock = NutUdpFindSocket(uh->uh_dport)) == 0) {
+        NutIcmpResponse(ICMP_UNREACH, ICMP_UNREACH_PORT, 0, nb);
         NutNetBufFree(nb);
         return;
     }




More information about the En-Nut-Discussion mailing list