diff options
author | Wolfgang Denk <wd@denx.de> | 2007-04-18 17:10:30 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2007-04-18 17:10:30 +0200 |
commit | 1d10b9e99d1b4a6a880d424ec791cde45cb04614 (patch) | |
tree | d3826be897f57a1d85797fb96e15dae8c360fbe7 /net | |
parent | 2a26ec4732efd7a308d0bbc97714c1d75ef1173b (diff) | |
parent | 443feb740584e406efa203af909fe2926608e8d5 (diff) |
Merge with /home/wd/git/u-boot/custodian/u-boot-net
Diffstat (limited to 'net')
-rw-r--r-- | net/net.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/net/net.c b/net/net.c index 1d1c98f3c20..2ff7bfc09f0 100644 --- 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; |