[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20160524.150136.139892523857598607.davem@davemloft.net>
Date: Tue, 24 May 2016 15:01:36 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: tom@...bertland.com
Cc: netdev@...r.kernel.org, kernel-team@...com
Subject: Re: [RFC PATCH 1/7] fou: Get net from sock_net if dev_net
unavailable
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?
Powered by blists - more mailing lists