Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp214877ybi; Fri, 26 Jul 2019 08:35:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqyaZJ/N3Pi6sbOraGZnsgexabptssXpl2CF6wLrft+SYNP3Lq4aCP78wc2sSLccBpjwNYjE X-Received: by 2002:a17:902:106:: with SMTP id 6mr98812396plb.64.1564155301952; Fri, 26 Jul 2019 08:35:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564155301; cv=none; d=google.com; s=arc-20160816; b=Q5dY8mnoMORoj2iLCtoaBMDr/gstoZS75HAjCPMFuwafprYKeA+EzJ2zVxPI9HqEQb zS06HMDGPzfmGsmInj7s9sz7LeRB+q1SBYjzAQ9BsQ218xOkGcgymoazSya6cRL8WJpH jdfySAX9+T/C1pxGMT/XDty7Ro8no8nir8e9leXveIJzaOVIttvOiMZVFSWcExus+qOV 9tY6YJsRqWbkJ17vdlYBQcLXcgTA/E2IGub4m5I0q9ahyoeRYlWS/IeOhtHKlRP2/Scm RgBTzKDUBSNu6xmY3mxWlygy3RtUzNtrkn8OWjBbqYf17e2HXIVLru6z7dRyPI6I9pvL 8x3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MoKzqCraqfQQnLq67yvcZpzKKdni8c+Bffsq8lqqVPM=; b=b0RtUVZ+OyoLD35jiXXvoO8mB4m5enJ3U5nCyvPayU0swnEkdqsK/ohnrG6NSD+zgg 6IZyJGXnJ1Vpo+1DKHSgZ6PK01r80Egycq15cHZFIx6xYniL86DNuztUnAMN7s41WhUn uRjt/GMutt2ab6UtCfZN+QYC1N0GvfzoR1t6xvxUNQvF1iOYEVw087NcZE90w3p4eUbt eB87g+q6dPQ6Oc/C2n0MlUTqpCkGHuD4d7t0LPxMEzVSrgU0SYXmN9CHRITKNjhKq8Pp 93jYeqd3Pc/nrvHacqaKKht68XUZKdQVuXiKxxzSLWhnG6x/Yk6oaAji8xHg5x0hkzW9 eCNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="ZQEqnH/4"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j6si23500768pgb.206.2019.07.26.08.34.47; Fri, 26 Jul 2019 08:35:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="ZQEqnH/4"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389647AbfGZPd1 (ORCPT + 99 others); Fri, 26 Jul 2019 11:33:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:48772 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389628AbfGZPdW (ORCPT ); Fri, 26 Jul 2019 11:33:22 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 7A051218D4; Fri, 26 Jul 2019 15:33:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564155201; bh=I8lIdewyWN4WEkd5GZx92YtQgBlT9zMW79sYzkF9Ko0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZQEqnH/4pT/9rASHrYe7ihDSdrMuBiP2c0zbpugh/eWQ79IFvAwFsU530lKU+E1Kz uF3YIahBrzGEIKkcX1spNLHYVECzCMerFdim675xVw40fJiWA5SjJPP1d3H9Eul4Jx xOcu8NGkS2uWFZyMc140dvZtK+B7cUSU/j7S2mOU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Cong Wang , "David S. Miller" Subject: [PATCH 4.19 29/50] net_sched: unset TCQ_F_CAN_BYPASS when adding filters Date: Fri, 26 Jul 2019 17:25:04 +0200 Message-Id: <20190726152303.612362667@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190726152300.760439618@linuxfoundation.org> References: <20190726152300.760439618@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Cong Wang [ Upstream commit 3f05e6886a595c9a29a309c52f45326be917823c ] For qdisc's that support TC filters and set TCQ_F_CAN_BYPASS, notably fq_codel, it makes no sense to let packets bypass the TC filters we setup in any scenario, otherwise our packets steering policy could not be enforced. This can be reproduced easily with the following script: ip li add dev dummy0 type dummy ifconfig dummy0 up tc qd add dev dummy0 root fq_codel tc filter add dev dummy0 parent 8001: protocol arp basic action mirred egress redirect dev lo tc filter add dev dummy0 parent 8001: protocol ip basic action mirred egress redirect dev lo ping -I dummy0 192.168.112.1 Without this patch, packets are sent directly to dummy0 without hitting any of the filters. With this patch, packets are redirected to loopback as expected. This fix is not perfect, it only unsets the flag but does not set it back because we have to save the information somewhere in the qdisc if we really want that. Note, both fq_codel and sfq clear this flag in their ->bind_tcf() but this is clearly not sufficient when we don't use any class ID. Fixes: 23624935e0c4 ("net_sched: TCQ_F_CAN_BYPASS generalization") Cc: Eric Dumazet Signed-off-by: Cong Wang Reviewed-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/sched/cls_api.c | 1 + net/sched/sch_fq_codel.c | 2 -- net/sched/sch_sfq.c | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -1325,6 +1325,7 @@ replay: tcf_chain_tp_insert(chain, &chain_info, tp); tfilter_notify(net, skb, n, tp, block, q, parent, fh, RTM_NEWTFILTER, false); + q->flags &= ~TCQ_F_CAN_BYPASS; } else { if (tp_created) tcf_proto_destroy(tp, NULL); --- a/net/sched/sch_fq_codel.c +++ b/net/sched/sch_fq_codel.c @@ -600,8 +600,6 @@ static unsigned long fq_codel_find(struc static unsigned long fq_codel_bind(struct Qdisc *sch, unsigned long parent, u32 classid) { - /* we cannot bypass queue discipline anymore */ - sch->flags &= ~TCQ_F_CAN_BYPASS; return 0; } --- a/net/sched/sch_sfq.c +++ b/net/sched/sch_sfq.c @@ -828,8 +828,6 @@ static unsigned long sfq_find(struct Qdi static unsigned long sfq_bind(struct Qdisc *sch, unsigned long parent, u32 classid) { - /* we cannot bypass queue discipline anymore */ - sch->flags &= ~TCQ_F_CAN_BYPASS; return 0; }