Merge tag 'stable/for-linus-3.8-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel...
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / net / ipv6 / exthdrs.c
index de6559e3aa0ace735175fdc13188969328a181d0..473f628f9f203d2e0c58466f32603ce50a330402 100644 (file)
 
 #include <asm/uaccess.h>
 
-int ipv6_find_tlv(struct sk_buff *skb, int offset, int type)
-{
-       const unsigned char *nh = skb_network_header(skb);
-       int packet_len = skb->tail - skb->network_header;
-       struct ipv6_opt_hdr *hdr;
-       int len;
-
-       if (offset + 2 > packet_len)
-               goto bad;
-       hdr = (struct ipv6_opt_hdr *)(nh + offset);
-       len = ((hdr->hdrlen + 1) << 3);
-
-       if (offset + len > packet_len)
-               goto bad;
-
-       offset += 2;
-       len -= 2;
-
-       while (len > 0) {
-               int opttype = nh[offset];
-               int optlen;
-
-               if (opttype == type)
-                       return offset;
-
-               switch (opttype) {
-               case IPV6_TLV_PAD1:
-                       optlen = 1;
-                       break;
-               default:
-                       optlen = nh[offset + 1] + 2;
-                       if (optlen > len)
-                               goto bad;
-                       break;
-               }
-               offset += optlen;
-               len -= optlen;
-       }
-       /* not_found */
- bad:
-       return -1;
-}
-EXPORT_SYMBOL_GPL(ipv6_find_tlv);
-
 /*
  *     Parsing tlv encoded headers.
  *
@@ -528,20 +484,12 @@ unknown_rh:
 
 static const struct inet6_protocol rthdr_protocol = {
        .handler        =       ipv6_rthdr_rcv,
-       .flags          =       INET6_PROTO_NOPOLICY | INET6_PROTO_GSO_EXTHDR,
-};
-
-static const struct net_offload rthdr_offload = {
-       .flags          =       INET6_PROTO_GSO_EXTHDR,
+       .flags          =       INET6_PROTO_NOPOLICY,
 };
 
 static const struct inet6_protocol destopt_protocol = {
        .handler        =       ipv6_destopt_rcv,
-       .flags          =       INET6_PROTO_NOPOLICY | INET6_PROTO_GSO_EXTHDR,
-};
-
-static const struct net_offload dstopt_offload = {
-       .flags          =       INET6_PROTO_GSO_EXTHDR,
+       .flags          =       INET6_PROTO_NOPOLICY,
 };
 
 static const struct inet6_protocol nodata_protocol = {
@@ -549,43 +497,13 @@ static const struct inet6_protocol nodata_protocol = {
        .flags          =       INET6_PROTO_NOPOLICY,
 };
 
-static int ipv6_exthdrs_offload_init(void)
-{
-       int ret;
-
-       ret = inet6_add_offload(&rthdr_offload, IPPROTO_ROUTING);
-       if (!ret)
-               goto out;
-
-       ret = inet6_add_offload(&dstopt_offload, IPPROTO_DSTOPTS);
-       if (!ret)
-               goto out_rt;
-
-out:
-       return ret;
-
-out_rt:
-       inet_del_offload(&rthdr_offload, IPPROTO_ROUTING);
-       goto out;
-}
-
-static void ipv6_exthdrs_offload_exit(void)
-{
-       inet_del_offload(&rthdr_offload, IPPROTO_ROUTING);
-       inet_del_offload(&rthdr_offload, IPPROTO_DSTOPTS);
-}
-
 int __init ipv6_exthdrs_init(void)
 {
        int ret;
 
-       ret = ipv6_exthdrs_offload_init();
-       if (ret)
-               goto out;
-
        ret = inet6_add_protocol(&rthdr_protocol, IPPROTO_ROUTING);
        if (ret)
-               goto out_offload;
+               goto out;
 
        ret = inet6_add_protocol(&destopt_protocol, IPPROTO_DSTOPTS);
        if (ret)
@@ -601,8 +519,6 @@ out_destopt:
        inet6_del_protocol(&destopt_protocol, IPPROTO_DSTOPTS);
 out_rthdr:
        inet6_del_protocol(&rthdr_protocol, IPPROTO_ROUTING);
-out_offload:
-       ipv6_exthdrs_offload_exit();
        goto out;
 };