netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 04/10] ipvs: do not use random local source address for tunnels
Date: Thu, 23 Jul 2015 01:00:46 +0200	[thread overview]
Message-ID: <1437606052-5179-5-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1437606052-5179-1-git-send-email-pablo@netfilter.org>

From: Julian Anastasov <ja@ssi.bg>

Michael Vallaly reports about wrong source address used
in rare cases for tunneled traffic. Looks like
__ip_vs_get_out_rt in 3.10+ is providing uninitialized
dest_dst->dst_saddr.ip because ip_vs_dest_dst_alloc uses
kmalloc. While we retry after seeing EINVAL from routing
for data that does not look like valid local address, it
still succeeded when this memory was previously used from
other dests and with different local addresses. As result,
we can use valid local address that is not suitable for
our real server.

Fix it by providing 0.0.0.0 every time our cache is refreshed.
By this way we will get preferred source address from routing.

Reported-by: Michael Vallaly <lvs@nolatency.com>
Fixes: 026ace060dfe ("ipvs: optimize dst usage for real server")
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
 net/netfilter/ipvs/ip_vs_xmit.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c
index b99d806..ec30d68 100644
--- a/net/netfilter/ipvs/ip_vs_xmit.c
+++ b/net/netfilter/ipvs/ip_vs_xmit.c
@@ -130,7 +130,6 @@ static struct rtable *do_output_route4(struct net *net, __be32 daddr,
 
 	memset(&fl4, 0, sizeof(fl4));
 	fl4.daddr = daddr;
-	fl4.saddr = (rt_mode & IP_VS_RT_MODE_CONNECT) ? *saddr : 0;
 	fl4.flowi4_flags = (rt_mode & IP_VS_RT_MODE_KNOWN_NH) ?
 			   FLOWI_FLAG_KNOWN_NH : 0;
 
-- 
1.7.10.4


  parent reply	other threads:[~2015-07-22 22:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-22 23:00 [PATCH 00/10] Netfilter/IPVS fixes for net Pablo Neira Ayuso
2015-07-22 23:00 ` [PATCH 01/10] netfilter: ctnetlink: put back references to master ct and expect objects Pablo Neira Ayuso
2015-07-22 23:00 ` [PATCH 02/10] netfilter: IDLETIMER: fix lockdep warning Pablo Neira Ayuso
2015-07-22 23:00 ` [PATCH 03/10] ipvs: fix ipv6 route unreach panic Pablo Neira Ayuso
2015-07-22 23:00 ` Pablo Neira Ayuso [this message]
2015-07-22 23:00 ` [PATCH 05/10] ipvs: fix crash if scheduler is changed Pablo Neira Ayuso
2015-07-22 23:00 ` [PATCH 06/10] ipvs: skb_orphan in case of forwarding Pablo Neira Ayuso
2015-07-22 23:00 ` [PATCH 07/10] ipvs: fix crash with sync protocol v0 and FTP Pablo Neira Ayuso
2015-07-22 23:00 ` [PATCH 08/10] ipvs: call skb_sender_cpu_clear Pablo Neira Ayuso
2015-07-22 23:00 ` [PATCH 09/10] netfilter: fix netns dependencies with conntrack templates Pablo Neira Ayuso
2015-07-22 23:00 ` [PATCH 10/10] netfilter: nf_conntrack: Support expectations in different zones Pablo Neira Ayuso
2015-07-25  7:18 ` [PATCH 00/10] Netfilter/IPVS fixes for net David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1437606052-5179-5-git-send-email-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).