From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5CE3C432C3 for ; Tue, 3 Dec 2019 21:34:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A526F207DD for ; Tue, 3 Dec 2019 21:34:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Y3FL72gG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727543AbfLCVeZ (ORCPT ); Tue, 3 Dec 2019 16:34:25 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:25475 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727430AbfLCVeZ (ORCPT ); Tue, 3 Dec 2019 16:34:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575408864; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rnD3VITWSjlaVbE4q1AGNQXRN6ub2ZDZ+V3FVYGlgO8=; b=Y3FL72gGq5xkYcXXX4EvoShNG3swzliXd0nTQt15ehen9A5T5Toi3l0lgysBJBcRQfCzMI r3a2KDEidOMRFyvpqxszffGIX/8Hije6YXSWUHg8wVIeuhKiwaq67gyfKTiNB6YY68BgVS dLzklNywq/B+Kj9onGO7EbAxHkJudv0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-142-F_iBIdSJOjmgHBfq5E6Deg-1; Tue, 03 Dec 2019 16:34:21 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AB14D1856A60; Tue, 3 Dec 2019 21:34:18 +0000 (UTC) Received: from dhcp-25.97.bos.redhat.com (ovpn-123-35.rdu2.redhat.com [10.10.123.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 267F55C28F; Tue, 3 Dec 2019 21:34:14 +0000 (UTC) From: Aaron Conole To: netdev@vger.kernel.org Cc: Pravin B Shelar , "David S . Miller" , Jamal Hadi Salim , Cong Wang , Jiri Pirko , dev@openvswitch.org, linux-kernel@vger.kernel.org, Marcelo Leitner , Paul Blakey , Roi Dayan , Nicolas Dichtel Subject: [PATCH 1/2] openvswitch: support asymmetric conntrack Date: Tue, 3 Dec 2019 16:34:13 -0500 Message-Id: <20191203213414.24109-1-aconole@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: F_iBIdSJOjmgHBfq5E6Deg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The openvswitch module shares a common conntrack and NAT infrastructure exposed via netfilter. It's possible that a packet needs both SNAT and DNAT manipulation, due to e.g. tuple collision. Netfilter can support this because it runs through the NAT table twice - once on ingress and again after egress. The openvswitch module doesn't have such capability. Like netfilter hook infrastructure, we should run through NAT twice to keep the symmetry. Fixes: 05752523e565 ("openvswitch: Interface with NAT.") Signed-off-by: Aaron Conole --- NOTE: this is a repost to see if the email client issues go away. net/openvswitch/conntrack.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c index df9c80bf621d..e726159cfcfa 100644 --- a/net/openvswitch/conntrack.c +++ b/net/openvswitch/conntrack.c @@ -903,6 +903,17 @@ static int ovs_ct_nat(struct net *net, struct sw_flow_= key *key, =09} =09err =3D ovs_ct_nat_execute(skb, ct, ctinfo, &info->range, maniptype); =20 +=09if (err =3D=3D NF_ACCEPT && +=09 ct->status & IPS_SRC_NAT && ct->status & IPS_DST_NAT) { +=09=09if (maniptype =3D=3D NF_NAT_MANIP_SRC) +=09=09=09maniptype =3D NF_NAT_MANIP_DST; +=09=09else +=09=09=09maniptype =3D NF_NAT_MANIP_SRC; + +=09=09err =3D ovs_ct_nat_execute(skb, ct, ctinfo, &info->range, +=09=09=09=09=09 maniptype); +=09} + =09/* Mark NAT done if successful and update the flow key. */ =09if (err =3D=3D NF_ACCEPT) =09=09ovs_nat_update_key(key, skb, maniptype); --=20 2.21.0