summaryrefslogtreecommitdiff
path: root/net/ipv4
diff options
context:
space:
mode:
authorFlorian Larysch <fl@n621.de>2017-04-03 16:46:09 +0200
committerSasha Levin <alexander.levin@verizon.com>2017-06-13 09:29:18 -0400
commit7d1a0fdd41f8796fc921b322b142b03586685b69 (patch)
tree9238dd5ffa52542a521b55ed0c5e9626e21bd8aa /net/ipv4
parent6824dcd302fd10e9764e89f78c0ac66b572e1394 (diff)
net: ipv4: fix multipath RTM_GETROUTE behavior when iif is given
[ Upstream commit a8801799c6975601fd58ae62f48964caec2eb83f ] inet_rtm_getroute synthesizes a skeletal ICMP skb, which is passed to ip_route_input when iif is given. If a multipath route is present for the designated destination, ip_multipath_icmp_hash ends up being called, which uses the source/destination addresses within the skb to calculate a hash. However, those are not set in the synthetic skb, causing it to return an arbitrary and incorrect result. Instead, use UDP, which gets no such special treatment. Signed-off-by: Florian Larysch <fl@n621.de> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/route.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index eb1d9839a257..6141fef3a64b 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2496,7 +2496,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh)
skb_reset_network_header(skb);
/* Bugfix: need to give ip_route_input enough of an IP header to not gag. */
- ip_hdr(skb)->protocol = IPPROTO_ICMP;
+ ip_hdr(skb)->protocol = IPPROTO_UDP;
skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr));
src = tb[RTA_SRC] ? nla_get_in_addr(tb[RTA_SRC]) : 0;