ip_tunnel(ipv4): fix tunnels with "local any remote $remote_ip"
authorDmitry Popov <ixaphire@qrator.net>
Mon, 28 Jul 2014 23:07:52 +0000 (03:07 +0400)
committerDavid S. Miller <davem@davemloft.net>
Wed, 30 Jul 2014 22:18:58 +0000 (15:18 -0700)
commit95cb5745983c222867cc9ac593aebb2ad67d72c0
treeaea09d3b5173d5365eb42cdb2dd11eee831062c6
parentdabf24d168ae7da5c3dc8c383db64b200e9ab483
ip_tunnel(ipv4): fix tunnels with "local any remote $remote_ip"

Ipv4 tunnels created with "local any remote $ip" didn't work properly since
7d442fab0 (ipv4: Cache dst in tunnels). 99% of packets sent via those tunnels
had src addr = 0.0.0.0. That was because only dst_entry was cached, although
fl4.saddr has to be cached too. Every time ip_tunnel_xmit used cached dst_entry
(tunnel_rtable_get returned non-NULL), fl4.saddr was initialized with
tnl_params->saddr (= 0 in our case), and wasn't changed until iptunnel_xmit().

This patch adds saddr to ip_tunnel->dst_cache, fixing this issue.

Reported-by: Sergey Popov <pinkbyte@gentoo.org>
Signed-off-by: Dmitry Popov <ixaphire@qrator.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/ip_tunnels.h
net/ipv4/ip_tunnel.c