From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adrien Mazarguil Subject: [PATCH 2/2] app/testpmd: compute checksum in icmpecho replies Date: Fri, 22 May 2015 13:07:32 +0200 Message-ID: <1432292852-15701-2-git-send-email-adrien.mazarguil@6wind.com> References: <1432292852-15701-1-git-send-email-adrien.mazarguil@6wind.com> To: dev@dpdk.org Return-path: Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com [209.85.212.179]) by dpdk.org (Postfix) with ESMTP id 8A02A5A57 for ; Fri, 22 May 2015 13:07:50 +0200 (CEST) Received: by wicmc15 with SMTP id mc15so37341956wic.1 for ; Fri, 22 May 2015 04:07:50 -0700 (PDT) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by mx.google.com with ESMTPSA id fs9sm2638694wjc.34.2015.05.22.04.07.49 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 22 May 2015 04:07:49 -0700 (PDT) In-Reply-To: <1432292852-15701-1-git-send-email-adrien.mazarguil@6wind.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" ICMP echo replies with invalid checksums may be dropped by network nodes or ignored by the ping utility. Signed-off-by: Adrien Mazarguil Acked-by: Ivan Boule --- app/test-pmd/icmpecho.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index c5933f4..c278baf 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -445,7 +445,8 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) * - switch IPv4 source and destinations addresses, * - set IP_ICMP_ECHO_REPLY in ICMP header. * No need to re-compute the IP header checksum. - * Reset ICMP checksum. + * ICMP checksum is computed by assuming it is valid in the + * echo request and not verified. */ ether_addr_copy(ð_h->s_addr, ð_addr); ether_addr_copy(ð_h->d_addr, ð_h->s_addr); @@ -454,7 +455,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ip_h->src_addr = ip_h->dst_addr; ip_h->dst_addr = ip_addr; icmp_h->icmp_type = IP_ICMP_ECHO_REPLY; - icmp_h->icmp_cksum = 0; + icmp_h->icmp_cksum += htons(IP_ICMP_ECHO_REQUEST << 8); pkts_burst[nb_replies++] = pkt; } -- 2.1.0