On 8/19/15 5:47 AM, Nikolay Aleksandrov wrote:

On Aug 18, 2015, at 6:54 PM, David Ahern <[email protected]> wrote:

Directs route lookups to VRF table. Compiles out if NET_VRF is not
enabled. With this patch able to successfully bring up ipsec tunnels
in VRFs, even with duplicate network configuration (IPv4 tested).

Signed-off-by: David Ahern <[email protected]>
---
net/ipv4/xfrm4_policy.c | 7 +++++--
net/ipv6/xfrm6_policy.c | 7 +++++--
2 files changed, 10 insertions(+), 4 deletions(-)

I think you should use the new vrf_master_index() helper that acquires rcu 
because
it looks possible to call ->decode_session() without rcu read lock, e.g. in the 
hold_timer
function xfrm_policy_queue_process(), though I haven’t tested it and might be 
missing
something. :-)

I was digging into code paths yesterday. Today I added WARN_ON and seems like the rcu_read_lock is held:

        if (skb_dst(skb)) {
WARN_ON(!rcu_read_lock_held() && !rcu_read_lock_bh_held());
                oif = vrf_master_ifindex_rcu(skb_dst(skb)->dev) ?
                        : skb_dst(skb)->dev->ifindex;
pr_info("_decode_session: oif %d skb_dst(skb)->dev->ifindex %d\n", oif, skb_dst(skb)->dev->ifindex);
        }

I get the printk, but not the WARN_ON splat.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to