diff options
author | Michal Kubecek <mkubecek@suse.cz> | 2013-05-28 02:26:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-05-28 02:39:19 -0400 |
commit | f96ef988cc603487c03a6de07807b06cbe641829 (patch) | |
tree | eeca4296492586db73ab13e22da6394203e25b3f /net/ipv4 | |
parent | 9a9c56cb34e65000d1f0a4b7553399bfcf7c5a52 (diff) |
ipv4: fix redirect handling for TCP packets
Unlike ipv4_redirect() and ipv4_sk_redirect(), ip_do_redirect()
doesn't call __build_flow_key() directly but via
ip_rt_build_flow_key() wrapper. This leads to __build_flow_key()
getting pointer to IPv4 header of the ICMP redirect packet
rather than pointer to the embedded IPv4 header of the packet
initiating the redirect.
As a result, handling of ICMP redirects initiated by TCP packets
is broken. Issue was introduced by
4895c771c ("ipv4: Add FIB nexthop exceptions.")
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/route.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 550781a17b34..d35bbf0cf404 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -737,10 +737,15 @@ static void ip_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buf | |||
737 | { | 737 | { |
738 | struct rtable *rt; | 738 | struct rtable *rt; |
739 | struct flowi4 fl4; | 739 | struct flowi4 fl4; |
740 | const struct iphdr *iph = (const struct iphdr *) skb->data; | ||
741 | int oif = skb->dev->ifindex; | ||
742 | u8 tos = RT_TOS(iph->tos); | ||
743 | u8 prot = iph->protocol; | ||
744 | u32 mark = skb->mark; | ||
740 | 745 | ||
741 | rt = (struct rtable *) dst; | 746 | rt = (struct rtable *) dst; |
742 | 747 | ||
743 | ip_rt_build_flow_key(&fl4, sk, skb); | 748 | __build_flow_key(&fl4, sk, iph, oif, tos, prot, mark, 0); |
744 | __ip_do_redirect(rt, skb, &fl4, true); | 749 | __ip_do_redirect(rt, skb, &fl4, true); |
745 | } | 750 | } |
746 | 751 | ||