[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALx6S36fGc2TRGBZeoXgZsxsMOi5nsms_zykHm09ZcYhAybqdA@mail.gmail.com>
Date: Tue, 24 May 2016 15:40:29 -0700
From: Tom Herbert <tom@...bertland.com>
To: David Miller <davem@...emloft.net>
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>,
Kernel Team <kernel-team@...com>
Subject: Re: [RFC PATCH 1/7] fou: Get net from sock_net if dev_net unavailable
On Tue, May 24, 2016 at 3:01 PM, David Miller <davem@...emloft.net> wrote:
> From: Tom Herbert <tom@...bertland.com>
> Date: Mon, 23 May 2016 15:48:20 -0700
>
>> diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c
>> index 5f9207c..96260c6 100644
>> --- a/net/ipv4/fou.c
>> +++ b/net/ipv4/fou.c
>> @@ -807,13 +807,20 @@ int __fou_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e,
>> u8 *protocol, __be16 *sport, int type)
>> {
>> int err;
>> + struct net *net;
>>
>
> Please order local variables from longest to shortest line.
>
>> err = iptunnel_handle_offloads(skb, type);
>> if (err)
>> return err;
>>
>> - *sport = e->sport ? : udp_flow_src_port(dev_net(skb->dev),
>> - skb, 0, 0, false);
>> + if (skb->dev)
>> + net = dev_net(skb->dev);
>> + else if (skb->sk)
>> + net = sock_net(skb->sk);
>
> This is getting rediculous. Why not just put the net namespace pointer into
> the tunnel encap object?
Thanks, in this case it will be easier to just pass net in as an argument.
Tom
Powered by blists - more mailing lists