From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 6B1223BA8E for ; Tue, 1 May 2018 15:41:32 -0400 (EDT) Received: by mail-pg0-x242.google.com with SMTP id a13-v6so8928667pgu.4 for ; Tue, 01 May 2018 12:41:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=hPXjI9gYg9gkDz6JH6mkX5xzWMbazvNOJy9xy+CtFUw=; b=ouVC1ej62yBYtaQRpdp2lqtha2OKoQlpJ6r1WC/L/jYpcJz8BZk852h54sAcrSilTr Acw1J0xeH0m6C1BWoJNEU/IimqufmbcNlD8d8BE1hdFVzn2MQIoY6JgaCOJmI/jE33PV fdRvH++u4U+i7nFxv/GtFej0Ne0iI4yzXk7B0u6+9VlkCJUGuqefYgpYTAJcKiTnp6+T W8oDOBUYjC9B+OD48A75N0/tXzvWbIsj4D/Cm5Iv4PWJXtkrQvRgyYFM4q03p0fP+Ufe CaNjvPfzunBTT0e6aQYUW6clvk3uJtwoHfIr9TEyHFDHTCXNMDres2Fu2MLuY6QdmGQO 3JPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=hPXjI9gYg9gkDz6JH6mkX5xzWMbazvNOJy9xy+CtFUw=; b=ngcgRM0ZecWVKc3h9td5aN31jjIu9TngQxZ/yrQqoH3CvF3h4SWWtRJPr82/OZmrpm IMebAsXvKbDKsF5g7njxuRckAxJVmIRTIfadSb4QdqD/44IB+hbDO4ViLUuDIQqZZt9D rOgZP8zZOpol4VX2B30NDBCjKLi23/GFDYDo2fj5MRc2QHg2EkF156hNK4raJgYve/xh eTqeE0CitImTtYSaiv3/pA3bYN8tbqs7t24IuVWSKtFU+N6AXg+Ra8MJQP1hWLOF+l4Y 7N/7GL5rvPDYi2lnlsepPSzjYNMpw99chCkqhUTWkSyLgIfQmd7VCRBEmm1VZ4DSTlnq 45Mg== X-Gm-Message-State: ALQs6tBCRBHJN0UhCS7GP126VxZUFROuJm+170NZhp7E76uLJg+BPVRH mkvSu+hAUNejAp0mmyUgzDKSTbYv X-Google-Smtp-Source: AB8JxZoQ9jFpHNkzPpXaYzx12XHmFzCUtRRsLM/bCZLUiv+495rmgP++71Z4+VZDSP+glKnD1edRQQ== X-Received: by 10.98.16.142 with SMTP id 14mr16725551pfq.22.1525203691484; Tue, 01 May 2018 12:41:31 -0700 (PDT) Received: from ?IPv6:2620:15c:2c1:200:55c7:81e6:c7d8:94b? ([2620:15c:2c1:200:55c7:81e6:c7d8:94b]) by smtp.gmail.com with ESMTPSA id h75sm101093pfh.148.2018.05.01.12.41.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 May 2018 12:41:30 -0700 (PDT) To: =?UTF-8?Q?Toke_H=c3=b8iland-J=c3=b8rgensen?= , Eric Dumazet , Dave Taht , Cong Wang Cc: Linux Kernel Network Developers , Cake List References: <20180429213439.7389-1-toke@toke.dk> <878t932ont.fsf@toke.dk> <4ec8da81-8671-f434-bada-27088b09ce7b@gmail.com> <871sev2mvx.fsf@toke.dk> From: Eric Dumazet Message-ID: Date: Tue, 1 May 2018 12:41:29 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <871sev2mvx.fsf@toke.dk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [Cake] [PATCH net-next v6] Add Common Applications Kept Enhanced (cake) qdisc 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: Tue, 01 May 2018 19:41:32 -0000 On 05/01/2018 12:31 PM, Toke Høiland-Jørgensen wrote: > Could you comment on specifically what you believe is broken in this, > please, so I can fix it in the same iteration? > Apart from the various pskb_may_pull() this helper should not change skb layout. Ideally, the skb should be const and you would use skb_header_pointer() to make clear you do not ever write this skb. This would make the reviewer job pretty easy, as no side effect can possibly happen. > +static inline struct tcphdr *cake_get_tcphdr(struct sk_buff *skb) > +{ > + struct ipv6hdr *ipv6h; > + struct iphdr *iph; > + > + /* check IPv6 header size immediately, since for IPv4 we need the space > + * for the TCP header anyway > + */ > + if (!pskb_may_pull(skb, skb_network_offset(skb) + > + sizeof(struct ipv6hdr))) > + return NULL; > + > + iph = ip_hdr(skb); > + > + if (iph->version == 4) { > + /* special-case 6in4 tunnelling, as that is a common way to get > + * v6 connectivity in the home > + */ > + if (iph->protocol == IPPROTO_IPV6) { > + if (!pskb_may_pull(skb, (skb_network_offset(skb) + > + ip_hdrlen(skb) + > + sizeof(struct ipv6hdr)))) > + return NULL; > + > + ipv6h = (struct ipv6hdr *)(skb_network_header(skb) + > + ip_hdrlen(skb)); > + > + if (ipv6h->nexthdr != IPPROTO_TCP) > + return NULL; > + > + skb_set_inner_network_header(skb, > + skb_network_offset(skb) + > + ip_hdrlen(skb)); > + skb_set_inner_transport_header(skb, > + skb_inner_network_offset(skb) + > + sizeof(struct ipv6hdr)); This is not allowed for a dissector.