flow_dissector: add support for dst, hop-by-hop and routing ext hdrs
authorTom Herbert <tom@herbertland.com>
Fri, 12 Jun 2015 16:01:06 +0000 (09:01 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 12 Jun 2015 21:24:28 +0000 (14:24 -0700)
If dst, hop-by-hop or routing extension headers are present determine
length of the options and skip over them in flow dissection.

Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/flow_dissector.c

index 1818cdcaa9b9be2e761d0bb0cae64e982e62b180..22e4dffa0c8b3b9a20a7324eae1627313e14ce30 100644 (file)
@@ -327,6 +327,7 @@ mpls:
                return false;
        }
 
+ip_proto_again:
        switch (ip_proto) {
        case IPPROTO_GRE: {
                struct gre_hdr {
@@ -383,6 +384,22 @@ mpls:
                }
                goto again;
        }
+       case NEXTHDR_HOP:
+       case NEXTHDR_ROUTING:
+       case NEXTHDR_DEST: {
+               u8 _opthdr[2], *opthdr;
+
+               if (proto != htons(ETH_P_IPV6))
+                       break;
+
+               opthdr = __skb_header_pointer(skb, nhoff, sizeof(_opthdr),
+                                             data, hlen, &_opthdr);
+
+               ip_proto = _opthdr[0];
+               nhoff += (_opthdr[1] + 1) << 3;
+
+               goto ip_proto_again;
+       }
        case IPPROTO_IPIP:
                proto = htons(ETH_P_IP);
                goto ip;