From: Jakub Sitnicki <jkbs@redhat.com>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
James Morris <jmorris@namei.org>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Patrick McHardy <kaber@trash.net>
Subject: [PATCH net-next 5/5] ipv6: Compute multipath hash for forwarded ICMP errors from offending packet
Date: Mon, 24 Oct 2016 11:28:52 +0200 [thread overview]
Message-ID: <1477301332-23954-6-git-send-email-jkbs@redhat.com> (raw)
In-Reply-To: <1477301332-23954-1-git-send-email-jkbs@redhat.com>
Same as for the transmit path, let's do our best to ensure that received
ICMP errors that may be subject to forwarding will be routed the same
path as flow that triggered the error, if it was going in the opposite
direction.
Signed-off-by: Jakub Sitnicki <jkbs@redhat.com>
---
net/ipv6/route.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 1184c2b..c0f38ea 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1150,6 +1150,30 @@ struct dst_entry *ip6_route_input_lookup(struct net *net,
}
EXPORT_SYMBOL_GPL(ip6_route_input_lookup);
+static u32 ip6_multipath_icmp_hash(const struct sk_buff *skb)
+{
+ const struct icmp6hdr *icmph = icmp6_hdr(skb);
+ const struct ipv6hdr *inner_iph;
+ struct ipv6hdr _inner_iph;
+
+ if (icmph->icmp6_type != ICMPV6_DEST_UNREACH &&
+ icmph->icmp6_type != ICMPV6_PKT_TOOBIG &&
+ icmph->icmp6_type != ICMPV6_TIME_EXCEED &&
+ icmph->icmp6_type != ICMPV6_PARAMPROB)
+ goto standard_hash;
+
+ inner_iph = skb_header_pointer(
+ skb, skb_transport_offset(skb) + sizeof(*icmph),
+ sizeof(_inner_iph), &_inner_iph);
+ if (!inner_iph)
+ goto standard_hash;
+
+ return icmpv6_multipath_hash(inner_iph);
+
+standard_hash:
+ return 0; /* compute it later, if needed */
+}
+
void ip6_route_input(struct sk_buff *skb)
{
const struct ipv6hdr *iph = ipv6_hdr(skb);
@@ -1168,6 +1192,8 @@ void ip6_route_input(struct sk_buff *skb)
tun_info = skb_tunnel_info(skb);
if (tun_info && !(tun_info->mode & IP_TUNNEL_INFO_TX))
fl6.flowi6_tun_key.tun_id = tun_info->key.tun_id;
+ if (unlikely(fl6.flowi6_proto == IPPROTO_ICMPV6))
+ fl6.mp_hash = ip6_multipath_icmp_hash(skb);
skb_dst_drop(skb);
skb_dst_set(skb, ip6_route_input_lookup(net, skb->dev, &fl6, flags));
}
--
2.7.4
next prev parent reply other threads:[~2016-10-24 9:28 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-24 9:28 [PATCH net-next 0/5] Route ICMPv6 errors with the flow when ECMP in use Jakub Sitnicki
2016-10-24 9:28 ` [PATCH net-next 1/5] ipv6: Fold rt6_info_hash_nhsfn() into its only caller Jakub Sitnicki
2016-10-24 9:28 ` [PATCH net-next 2/5] net: Extend struct flowi6 with multipath hash Jakub Sitnicki
2016-10-24 9:39 ` Hannes Frederic Sowa
2016-10-24 9:28 ` [PATCH net-next 3/5] ipv6: Use multipath hash from flow info if available Jakub Sitnicki
2016-10-24 9:40 ` Hannes Frederic Sowa
2016-10-24 9:28 ` [PATCH net-next 4/5] ipv6: Compute multipath hash for sent ICMP errors from offending packet Jakub Sitnicki
2016-10-24 9:40 ` Hannes Frederic Sowa
2016-10-27 15:24 ` David Miller
2016-10-27 22:00 ` Jakub Sitnicki
2016-10-24 9:28 ` Jakub Sitnicki [this message]
2016-10-24 9:43 ` [PATCH net-next 5/5] ipv6: Compute multipath hash for forwarded " Hannes Frederic Sowa
2016-10-27 15:25 ` David Miller
2016-10-27 22:10 ` Jakub Sitnicki
2016-10-27 22:35 ` Tom Herbert
2016-10-28 8:32 ` Jakub Sitnicki
2016-10-28 14:25 ` Tom Herbert
2016-10-30 13:03 ` Jakub Sitnicki
2016-10-31 19:15 ` David Miller
2016-11-01 15:13 ` Jakub Sitnicki
2016-11-01 15:35 ` David Miller
2016-11-01 16:26 ` Jakub Sitnicki
2016-11-01 16:27 ` Hannes Frederic Sowa
2016-11-01 16:39 ` David Miller
2016-11-01 16:59 ` Hannes Frederic Sowa
2016-10-31 19:25 ` Tom Herbert
2016-11-01 15:43 ` Jakub Sitnicki
2016-11-01 16:25 ` Hannes Frederic Sowa
2016-11-01 16:39 ` Tom Herbert
2016-11-01 16:54 ` Hannes Frederic Sowa
2016-10-27 15:23 ` [PATCH net-next 0/5] Route ICMPv6 errors with the flow when ECMP in use David Miller
2016-10-27 21:54 ` Hannes Frederic Sowa
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=1477301332-23954-6-git-send-email-jkbs@redhat.com \
--to=jkbs@redhat.com \
--cc=davem@davemloft.net \
--cc=jmorris@namei.org \
--cc=kaber@trash.net \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.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).