diff options
Diffstat (limited to 'net/core/flow_dissector.c')
-rw-r--r-- | net/core/flow_dissector.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 2c35c02a931e..3556791fdc6e 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -113,7 +113,6 @@ ip: case htons(ETH_P_IPV6): { const struct ipv6hdr *iph; struct ipv6hdr _iph; - __be32 flow_label; ipv6: iph = __skb_header_pointer(skb, nhoff, sizeof(_iph), data, hlen, &_iph); @@ -130,8 +129,9 @@ ipv6: flow->src = (__force __be32)ipv6_addr_hash(&iph->saddr); flow->dst = (__force __be32)ipv6_addr_hash(&iph->daddr); - flow_label = ip6_flowlabel(iph); - if (flow_label) { + if (skb && ip6_flowlabel(iph)) { + __be32 flow_label = ip6_flowlabel(iph); + /* Awesome, IPv6 packet has a flow label so we can * use that to represent the ports without any * further dissection. @@ -233,6 +233,13 @@ ipv6: return false; proto = eth->h_proto; nhoff += sizeof(*eth); + + /* Cap headers that we access via pointers at the + * end of the Ethernet header as our maximum alignment + * at that point is only 2 bytes. + */ + if (NET_IP_ALIGN) + hlen = nhoff; } goto again; } |