Merge with /home/wd/git/u-boot/custodian/u-boot-net
authorWolfgang Denk <wd@denx.de>
Wed, 18 Apr 2007 15:10:30 +0000 (17:10 +0200)
committerWolfgang Denk <wd@denx.de>
Wed, 18 Apr 2007 15:10:30 +0000 (17:10 +0200)
doc/README.NetConsole
net/net.c

index cc35a0a8ffe1148c91914b75bd3725e5533d0a2b..fea8e336466f42a277ff143b30cf6a7d89654360 100644 (file)
@@ -38,6 +38,11 @@ The script expects exactly one argument, which is interpreted as  the
 target IP address (or host name, assuming DNS is working). The script
 can be interrupted by pressing ^T (CTRL-T).
 
+Be aware that in some distributives (Fedora Core 5 at least)
+usage of nc has been changed and -l and -p options are considered
+as mutually exclusive. If nc complains about options provided,
+you can just remove the -p option from the script.
+
 It turns out that 'netcat' cannot be used to listen to broadcast
 packets. We developed our own tool 'ncb' (see tools directory) that
 listens to broadcast packets on a given port and dumps them to the
index 1d1c98f3c20204c74ef3173b50537e21af8c60cd..2ff7bfc09f0bf63ae6ca488df6fabce7f44d32b7 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -1424,6 +1424,26 @@ NetReceive(volatile uchar * inpkt, int len)
                                /* XXX point to ip packet */
                                (*packetHandler)((uchar *)ip, 0, 0, 0);
                                return;
+                       case ICMP_ECHO_REQUEST:
+#ifdef ET_DEBUG
+                               printf ("Got ICMP ECHO REQUEST, return %d bytes \n",
+                                       ETHER_HDR_SIZE + len);
+#endif
+                               memcpy (&et->et_dest[0], &et->et_src[0], 6);
+                               memcpy (&et->et_src[ 0], NetOurEther, 6);
+
+                               ip->ip_sum = 0;
+                               ip->ip_off = 0;
+                               NetCopyIP((void*)&ip->ip_dst, &ip->ip_src);
+                               NetCopyIP((void*)&ip->ip_src, &NetOurIP);
+                               ip->ip_sum = ~NetCksum((uchar *)ip, IP_HDR_SIZE_NO_UDP >> 1);
+
+                               icmph->type = ICMP_ECHO_REPLY;
+                               icmph->checksum = 0;
+                               icmph->checksum = ~NetCksum((uchar *)icmph,
+                                               (len - IP_HDR_SIZE_NO_UDP) >> 1);
+                               (void) eth_send((uchar *)et, ETHER_HDR_SIZE + len);
+                               return;
 #endif
                        default:
                                return;