From patchwork Fri Jan 24 09:28:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 232985 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 F0374C2D0DB for ; Fri, 24 Jan 2020 11:18:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B768B2075D for ; Fri, 24 Jan 2020 11:18:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579864684; bh=3NiqEoj2Y5pVgGxdEdDMggCoFAh4dCge3GczTBOPzQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=MfijhMURjAf+eAZn+9KOEvcx88IbXjyUfmaJdLKOym2UyQV99EiNAhu5NMOCZeQM4 Kg9CVr/wim5VWMRSnhAeAwjP52UlYBo/8AvP22R8KVW3VzvxJllq2vgrfT1g7R8928 AgeB8Tyaqz5A00vtxS+xR3i4PWcFV4xwhA9NVmZ8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390390AbgAXLSD (ORCPT ); Fri, 24 Jan 2020 06:18:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:55004 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390583AbgAXLSA (ORCPT ); Fri, 24 Jan 2020 06:18:00 -0500 Received: from localhost (ip-213-127-102-57.ip.prioritytelecom.net [213.127.102.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0A14720708; Fri, 24 Jan 2020 11:17:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579864679; bh=3NiqEoj2Y5pVgGxdEdDMggCoFAh4dCge3GczTBOPzQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0V1hV73wvLAQr8qwyi8Tf3swvK2icfBbAwLf9LcP/3qD8kw/8W4+ka/Su22iCa/YE SrQ6lpA7P5sP0/FmM3ETxiVe3gpJfVh6ycb9J5K+gO9lofJ6SyVsy9f6RHjFuBVOHK lGSbZtkAcL0MUCIvNpn+HHJ5RLCL1g/wriwpe2xw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 4.19 335/639] netfilter: nft_flow_offload: add entry to flowtable after confirmation Date: Fri, 24 Jan 2020 10:28:25 +0100 Message-Id: <20200124093129.078918958@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200124093047.008739095@linuxfoundation.org> References: <20200124093047.008739095@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Pablo Neira Ayuso [ Upstream commit 270a8a297f42ecff82060aaa53118361f09c1f7d ] This is fixing flow offload for UDP traffic where packets only follow one single direction. The flow_offload_fixup_tcp() mechanism works fine in case that the offloaded entry remains in SYN_RECV state, given sequence tracking is reset and that conntrack handles syn+ack packets as a retransmission, ie. sES + synack => sIG for reply traffic. Fixes: a3c90f7a2323 ("netfilter: nf_tables: flow offload expression") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/nft_flow_offload.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/netfilter/nft_flow_offload.c b/net/netfilter/nft_flow_offload.c index 1ef8cb789c41a..166edea0e4527 100644 --- a/net/netfilter/nft_flow_offload.c +++ b/net/netfilter/nft_flow_offload.c @@ -103,8 +103,7 @@ static void nft_flow_offload_eval(const struct nft_expr *expr, ct->status & IPS_SEQ_ADJUST) goto out; - if (ctinfo == IP_CT_NEW || - ctinfo == IP_CT_RELATED) + if (!nf_ct_is_confirmed(ct)) goto out; if (test_and_set_bit(IPS_OFFLOAD_BIT, &ct->status))