All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: "Toke Høiland-Jørgensen" <toke@toke.dk>,
	"Eric Dumazet" <eric.dumazet@gmail.com>,
	"Dave Taht" <dave.taht@gmail.com>,
	"Cong Wang" <xiyou.wangcong@gmail.com>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>,
	Cake List <cake@lists.bufferbloat.net>
Subject: Re: [PATCH net-next v6] Add Common Applications Kept Enhanced (cake) qdisc
Date: Tue, 1 May 2018 12:41:29 -0700	[thread overview]
Message-ID: <c43e3156-dce2-ced7-3a8f-47fe756202f9@gmail.com> (raw)
In-Reply-To: <871sev2mvx.fsf@toke.dk>



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.

  reply	other threads:[~2018-05-01 19:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-29 21:34 [PATCH net-next v6] Add Common Applications Kept Enhanced (cake) qdisc Toke Høiland-Jørgensen
2018-04-30 21:21 ` Cong Wang
2018-04-30 21:27   ` Dave Taht
2018-04-30 23:04     ` Cong Wang
2018-05-01 11:36       ` Toke Høiland-Jørgensen
2018-05-01 16:06     ` Eric Dumazet
2018-05-01 18:31       ` [Cake] " Jonathan Morton
2018-05-01 18:53       ` Toke Høiland-Jørgensen
2018-05-01 19:12         ` Eric Dumazet
2018-05-01 19:14           ` David Miller
2018-05-01 19:31           ` Toke Høiland-Jørgensen
2018-05-01 19:41             ` Eric Dumazet [this message]
2018-05-01 21:54               ` Toke Høiland-Jørgensen
2018-05-01 22:31           ` Cong Wang
2018-05-01 19:22         ` Dave Taht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c43e3156-dce2-ced7-3a8f-47fe756202f9@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=cake@lists.bufferbloat.net \
    --cc=dave.taht@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=toke@toke.dk \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.