Skip to content

Commit

Permalink
flow_dissector: Use IPv6 flow label in flow_dissector
Browse files Browse the repository at this point in the history
This patch implements the receive side to support RFC 6438 which is to
use the flow label as an ECMP hash. If an IPv6 flow label is set
in a packet we can use this as input for computing an L4-hash. There
should be no need to parse any transport headers in this case.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Tom Herbert authored and David S. Miller committed Jul 8, 2014
1 parent 535fb8d commit 19469a8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions net/core/flow_dissector.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow)
case htons(ETH_P_IPV6): {
const struct ipv6hdr *iph;
struct ipv6hdr _iph;
__be32 flow_label;

ipv6:
iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph);
if (!iph)
Expand All @@ -89,6 +91,21 @@ bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow)
flow->src = (__force __be32)ipv6_addr_hash(&iph->saddr);
flow->dst = (__force __be32)ipv6_addr_hash(&iph->daddr);
nhoff += sizeof(struct ipv6hdr);

flow_label = ip6_flowlabel(iph);
if (flow_label) {
/* Awesome, IPv6 packet has a flow label so we can
* use that to represent the ports without any
* further dissection.
*/
flow->n_proto = proto;
flow->ip_proto = ip_proto;
flow->ports = flow_label;
flow->thoff = (u16)nhoff;

return true;
}

break;
}
case htons(ETH_P_8021AD):
Expand Down

0 comments on commit 19469a8

Please sign in to comment.