Commit 212c45ac authored by Julian Anastasov's avatar Julian Anastasov Committed by Greg Kroah-Hartman

ipvs: do not use random local source address for tunnels

commit 4754957f04f5f368792a0eb7dab0ae89fb93dcfd upstream.

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 every time our cache is refreshed.
By this way we will get preferred source address from routing.
Reported-by: default avatarMichael Vallaly <>
Fixes: 026ace06 ("ipvs: optimize dst usage for real server")
Signed-off-by: default avatarJulian Anastasov <>
Signed-off-by: default avatarSimon Horman <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 162d3c2f
......@@ -129,7 +129,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) ?
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment