Netdev List
 help / color / mirror / Atom feed
From: Thomas Graf <tgraf@suug.ch>
To: Pravin B Shelar <pshelar@nicira.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH v5 net-next 5/8] geneve: Add support to collect tunnel metadata.
Date: Thu, 27 Aug 2015 11:18:54 +0200	[thread overview]
Message-ID: <20150827091854.GD18481@pox.localdomain> (raw)
In-Reply-To: <1440658015-13028-6-git-send-email-pshelar@nicira.com>

On 08/26/15 at 11:46pm, Pravin B Shelar wrote:
> +	if (ip_tunnel_collect_metadata() || geneve->collect_md) {
> +		__be16 flags;
> +		void *opts;
> +
> +		flags = TUNNEL_KEY | TUNNEL_GENEVE_OPT |
> +			(gnvh->oam ? TUNNEL_OAM : 0) |
> +			(gnvh->critical ? TUNNEL_CRIT_OPT : 0);
> +
> +		tun_dst = udp_tun_rx_dst(skb, AF_INET, flags,
> +					 vni_to_tunnel_id(gnvh->vni),
> +					 gnvh->opt_len * 4);
> +		if (!tun_dst)
> +			goto drop;
> +
> +		/* Update tunnel dst according to Geneve options. */
> +		opts = ip_tunnel_info_opts(&tun_dst->u.tun_info,
> +					   gnvh->opt_len * 4);
> +		memcpy(opts, gnvh->options, gnvh->opt_len * 4);
> +	} else {
> +		/* Drop packets w/ critical options,
> +		 * since we don't support any...
> +		 */
> +		if (gnvh->critical)
> +			goto drop;
> +	}
>  
>  	skb_reset_mac_header(skb);
>  	skb_scrub_packet(skb, !net_eq(geneve->net, dev_net(geneve->dev)));
>  	skb->protocol = eth_type_trans(skb, geneve->dev);
>  	skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
>  
> +	if (tun_dst)
> +		skb_dst_set(skb, &tun_dst->dst);

It is slightly non obvious that introducing an error condition above
this and before udp_tun_rx_dst() would introduce a memory leak. Other
than this looks great now.

Acked-by: Thomas Graf <tgraf@suug.ch>

  reply	other threads:[~2015-08-27  9:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-27  6:46 [PATCH v5 net-next 0/8] geneve: Add support for tunnel metadata mode Pravin B Shelar
2015-08-27  6:46 ` [PATCH v5 net-next 1/8] geneve: Initialize ethernet address in device setup Pravin B Shelar
2015-08-27  6:46 ` [PATCH v5 net-next 2/8] geneve: Use skb mark and protocol to lookup route Pravin B Shelar
2015-08-27  6:46 ` [PATCH v5 net-next 3/8] tunnel: introduce udp_tun_rx_dst() Pravin B Shelar
2015-08-27  6:46 ` [PATCH v5 net-next 4/8] geneve: Make dst-port configurable Pravin B Shelar
2015-08-27  6:46 ` [PATCH v5 net-next 5/8] geneve: Add support to collect tunnel metadata Pravin B Shelar
2015-08-27  9:18   ` Thomas Graf [this message]
2015-08-27 21:29     ` Pravin Shelar
2015-08-28 10:22       ` Thomas Graf
2015-08-27  6:46 ` [PATCH v5 net-next 6/8] openvswitch: Use Geneve device Pravin B Shelar
2015-08-27  9:19   ` Thomas Graf
2015-08-27  6:46 ` [PATCH v5 net-next 7/8] geneve: Consolidate Geneve functionality in single module Pravin B Shelar
2015-08-27 16:31   ` Jesse Gross
2015-08-27 17:28   ` John W. Linville
2015-08-27  6:46 ` [PATCH v5 net-next 8/8] geneve: Move device hash table to geneve socket Pravin B Shelar

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=20150827091854.GD18481@pox.localdomain \
    --to=tgraf@suug.ch \
    --cc=netdev@vger.kernel.org \
    --cc=pshelar@nicira.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox