[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALnjE+pDWPEbuZ1--bk433x39BXvkf6ZcMcfhbg45DZBMV+HBQ@mail.gmail.com>
Date: Thu, 27 Aug 2015 14:29:26 -0700
From: Pravin Shelar <pshelar@...ira.com>
To: Thomas Graf <tgraf@...g.ch>
Cc: netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH v5 net-next 5/8] geneve: Add support to collect tunnel metadata.
On Thu, Aug 27, 2015 at 2:18 AM, Thomas Graf <tgraf@...g.ch> wrote:
> 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.
>
I can not move this into if condition block since skb-scrub-packet
drops skb dst entry.
> Acked-by: Thomas Graf <tgraf@...g.ch>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists