From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from shards.monkeyblade.net (shards.monkeyblade.net [IPv6:2620:137:e000::1:9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 723C73B2A4 for ; Fri, 3 Jul 2020 17:35:42 -0400 (EDT) Received: from localhost (unknown [IPv6:2601:601:9f00:477::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 0F60F155CAC70; Fri, 3 Jul 2020 14:35:41 -0700 (PDT) Date: Fri, 03 Jul 2020 14:35:38 -0700 (PDT) Message-Id: <20200703.143538.815540028775269364.davem@davemloft.net> To: toke@redhat.com Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, cake@lists.bufferbloat.net, dcaratti@redhat.com, jiri@resnulli.us, jhs@mojatatu.com, xiyou.wangcong@gmail.com, mrv@mojatatu.com, brakmo@fb.com, i.ponetaev@ndmsystems.com From: David Miller In-Reply-To: <20200703202643.12919-1-toke@redhat.com> References: <20200703202643.12919-1-toke@redhat.com> X-Mailer: Mew version 6.8 on Emacs 26.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Fri, 03 Jul 2020 14:35:41 -0700 (PDT) X-Mailman-Approved-At: Fri, 03 Jul 2020 19:09:58 -0400 Subject: Re: [Cake] [PATCH net v3] sched: consistently handle layer3 header accesses in the presence of VLANs X-BeenThere: cake@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: Cake - FQ_codel the next generation List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jul 2020 21:35:42 -0000 From: Toke H=F8iland-J=F8rgensen Date: Fri, 3 Jul 2020 22:26:43 +0200 > There are a couple of places in net/sched/ that check skb->protocol a= nd act > on the value there. However, in the presence of VLAN tags, the value = stored > in skb->protocol can be inconsistent based on whether VLAN accelerati= on is > enabled. The commit quoted in the Fixes tag below fixed the users of > skb->protocol to use a helper that will always see the VLAN ethertype= .= > = > However, most of the callers don't actually handle the VLAN ethertype= , but > expect to find the IP header type in the protocol field. This means t= hat > things like changing the ECN field, or parsing diffserv values, stops= > working if there's a VLAN tag, or if there are multiple nested VLAN > tags (QinQ). > = > To fix this, change the helper to take an argument that indicates whe= ther > the caller wants to skip the VLAN tags or not. When skipping VLAN tag= s, we > make sure to skip all of them, so behaviour is consistent even in Qin= Q > mode. > = > To make the helper usable from the ECN code, move it to if_vlan.h ins= tead > of pkt_sched.h. > = > v3: > - Remove empty lines > - Move vlan variable definitions inside loop in skb_protocol() > - Also use skb_protocol() helper in IP{,6}_ECN_decapsulate() and > bpf_skb_ecn_set_ce() > = > v2: > - Use eth_type_vlan() helper in skb_protocol() > - Also fix code that reads skb->protocol directly > - Change a couple of 'if/else if' statements to switch constructs to = avoid > calling the helper twice > = > Reported-by: Ilya Ponetayev > Fixes: d8b9605d2697 ("net: sched: fix skb->protocol use in case of ac= celerated vlan path") > Signed-off-by: Toke H=F8iland-J=F8rgensen Looks good, applied and queued up for -stable. Thanks!