From patchwork Tue May 12 09:25:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 1288317 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49Lsqs2D8Lz9sRY for ; Tue, 12 May 2020 19:26:16 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 4B3F888300; Tue, 12 May 2020 09:26:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Nq8OubrCLGVu; Tue, 12 May 2020 09:26:11 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 5A8CA882C7; Tue, 12 May 2020 09:26:11 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 473EDC088A; Tue, 12 May 2020 09:26:11 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9C8A8C016F for ; Tue, 12 May 2020 09:26:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 8036086F52 for ; Tue, 12 May 2020 09:26:10 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UZvbhoHAVFLW for ; Tue, 12 May 2020 09:26:09 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 2A1CA86F41 for ; Tue, 12 May 2020 09:26:09 +0000 (UTC) X-Originating-IP: 115.99.44.140 Received: from nusiddiq.home.org.com (unknown [115.99.44.140]) (Authenticated sender: numans@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id C94611C0018; Tue, 12 May 2020 09:26:04 +0000 (UTC) From: numans@ovn.org To: dev@openvswitch.org Date: Tue, 12 May 2020 14:55:57 +0530 Message-Id: <20200512092557.530039-1-numans@ovn.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn] pinctrl: Fix icmp6 packet corruption issue X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Numan Siddique The commit f792b1a00b43("Fix ACL reject action for UDP packets.") didn't updated the 'struct ip6_hdr' pointer after calling dp_packet_put(), as dp_packet_put() can reallocate memory making the old references to packet pointers invalid. This patch fixes this issue. Fixes: f792b1a00b43("Fix ACL reject action for UDP packets.") Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1834655 Signed-off-by: Numan Siddique Acked-by: Dumitru Ceara --- controller/pinctrl.c | 4 ++-- tests/system-ovn.at | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/controller/pinctrl.c b/controller/pinctrl.c index 6b0ac3483..d976ec82b 100644 --- a/controller/pinctrl.c +++ b/controller/pinctrl.c @@ -1570,8 +1570,6 @@ pinctrl_handle_icmp(struct rconn *swconn, const struct flow *ip_flow, } ih->icmp6_base.icmp6_cksum = 0; - nh = dp_packet_l3(&packet); - /* RFC 4443: 3.1. * * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 @@ -1594,9 +1592,11 @@ pinctrl_handle_icmp(struct rconn *swconn, const struct flow *ip_flow, } dp_packet_put(&packet, in_ip, in_ip_len); + nh = dp_packet_l3(&packet); nh->ip6_plen = htons(ICMP6_DATA_HEADER_LEN + in_ip_len); icmpv6_csum = packet_csum_pseudoheader6(dp_packet_l3(&packet)); + ih = dp_packet_l4(&packet); ih->icmp6_base.icmp6_cksum = csum_finish( csum_continue(icmpv6_csum, ih, in_ip_len + ICMP6_DATA_HEADER_LEN)); diff --git a/tests/system-ovn.at b/tests/system-ovn.at index 9a5ef1ec3..d0240840d 100644 --- a/tests/system-ovn.at +++ b/tests/system-ovn.at @@ -3967,7 +3967,7 @@ OVS_WAIT_UNTIL([ NS_CHECK_EXEC([sw0-p1-rej], [tcpdump -n -c 1 -i sw0-p1-rej udp port 90 > sw0-p1-rej-udp.pcap &], [0]) NS_CHECK_EXEC([sw0-p1-rej], [tcpdump -n -c 1 -i sw0-p1-rej icmp > sw0-p1-rej-icmp.pcap &], [0]) -echo "foo" > foo +echo "foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo" > foo OVS_WAIT_UNTIL([ ip netns exec sw0-p1-rej nc -u 10.0.0.4 90 < foo c=$(cat sw0-p1-rej-icmp.pcap | grep \