From patchwork Fri Jan 25 11:08:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li,Rongqing" X-Patchwork-Id: 1031008 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=baidu.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43mGXr1Fb5z9s7h for ; Fri, 25 Jan 2019 22:10:51 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 718CC1011; Fri, 25 Jan 2019 11:10:48 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 180F6FE6 for ; Fri, 25 Jan 2019 11:08:38 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from tc-sys-mailedm01.tc.baidu.com (mx56.baidu.com [61.135.168.56]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id C036B8A for ; Fri, 25 Jan 2019 11:08:36 +0000 (UTC) Received: from localhost (cp01-cos-dev01.cp01.baidu.com [10.92.119.46]) by tc-sys-mailedm01.tc.baidu.com (Postfix) with ESMTP id 950A5204004F for ; Fri, 25 Jan 2019 19:08:33 +0800 (CST) From: Li RongQing To: dev@openvswitch.org Date: Fri, 25 Jan 2019 19:08:33 +0800 Message-Id: <1548414513-4416-1-git-send-email-lirongqing@baidu.com> X-Mailer: git-send-email 1.7.1 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] flow: fix udp checksum X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org As per RFC 768, if the calculated UDP checksum is 0, it should be instead set as 0xFFFF in the frame. A value of 0 in the checksum field indicates to the receiver that no checksum was calculated and hence it should not verify the checksum. Signed-off-by: Li RongQing --- lib/flow.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/flow.c b/lib/flow.c index c60446ff4..c6e47781b 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -3023,6 +3023,9 @@ flow_compose_l4_csum(struct dp_packet *p, const struct flow *flow, udp->udp_csum = 0; udp->udp_csum = csum_finish(csum_continue(pseudo_hdr_csum, udp, l4_len)); + if (!udp->udp_csum) { + udp->udp_csum = htons(0xffff); + } } else if (flow->nw_proto == IPPROTO_ICMP) { struct icmp_header *icmp = dp_packet_l4(p);