diff options
author | Josh Blum <josh@joshknows.com> | 2011-02-09 20:04:31 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-02-09 20:04:31 -0800 |
commit | f73f2410ee33648538d5fde92bd018b3e96ed548 (patch) | |
tree | 1b816c2e72529db4b1a5195b9ffd326089c1b90f /firmware | |
parent | aa73e29d507f1523c17cf625dbd9c68f5a7d3787 (diff) | |
parent | fa35192bcb89c6f026d76d7f5190e22341840a47 (diff) | |
download | uhd-f73f2410ee33648538d5fde92bd018b3e96ed548.tar.gz uhd-f73f2410ee33648538d5fde92bd018b3e96ed548.tar.bz2 uhd-f73f2410ee33648538d5fde92bd018b3e96ed548.zip |
Merge branch 'master' into next
Conflicts:
host/lib/transport/udp_zero_copy_asio.cpp
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/zpu/lib/net_common.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/firmware/zpu/lib/net_common.c b/firmware/zpu/lib/net_common.c index ec9198090..d1b06976d 100644 --- a/firmware/zpu/lib/net_common.c +++ b/firmware/zpu/lib/net_common.c @@ -298,20 +298,28 @@ handle_icmp_packet(struct ip_addr src, struct ip_addr dst, break; case ICMP_ECHO:{ + const void *icmp_data_buff = ((uint8_t*)icmp) + sizeof(struct icmp_echo_hdr); + size_t icmp_data_len = len - sizeof(struct icmp_echo_hdr); + struct icmp_echo_hdr echo_reply; echo_reply.type = 0; echo_reply.code = 0; echo_reply.chksum = 0; echo_reply.id = icmp->id; echo_reply.seqno = icmp->seqno; - echo_reply.chksum = ~chksum_buffer( - (unsigned short *)&echo_reply, - sizeof(echo_reply)/sizeof(short), - 0); + echo_reply.chksum = ~chksum_buffer( //data checksum + (unsigned short *)icmp_data_buff, + icmp_data_len/sizeof(short), + chksum_buffer( //header checksum + (unsigned short *)&echo_reply, + sizeof(echo_reply)/sizeof(short), + 0) + ); + send_ip_pkt( - src, IP_PROTO_ICMP, &echo_reply, sizeof(echo_reply), - ((uint8_t*)icmp) + sizeof(struct icmp_echo_hdr), - len - sizeof(struct icmp_echo_hdr) + src, IP_PROTO_ICMP, + &echo_reply, sizeof(echo_reply), + icmp_data_buff, icmp_data_len ); break; } |