Skip to content

Commit cc5a5c0

Browse files
florolfgregkh
authored andcommitted
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 593e185 commit cc5a5c0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

net/ipv4/route.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2559,7 +2559,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh)
25592559
skb_reset_network_header(skb);
25602560

25612561
/* Bugfix: need to give ip_route_input enough of an IP header to not gag. */
2562-
ip_hdr(skb)->protocol = IPPROTO_ICMP;
2562+
ip_hdr(skb)->protocol = IPPROTO_UDP;
25632563
skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr));
25642564

25652565
src = tb[RTA_SRC] ? nla_get_in_addr(tb[RTA_SRC]) : 0;

0 commit comments

Comments
 (0)