[IPV6]: Export some symbols for DCCPv6
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / net / ipv6 / exthdrs.c
index 922549581abc266100d6a3a28676665dd509f858..113374dc342c1fdd116173572131853437076d48 100644 (file)
@@ -413,6 +413,8 @@ ipv6_invert_rthdr(struct sock *sk, struct ipv6_rt_hdr *hdr)
        return opt;
 }
 
+EXPORT_SYMBOL_GPL(ipv6_invert_rthdr);
+
 /**********************************
   Hop-by-hop options.
  **********************************/
@@ -579,6 +581,8 @@ ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt)
        return opt2;
 }
 
+EXPORT_SYMBOL_GPL(ipv6_dup_options);
+
 static int ipv6_renew_option(void *ohdr,
                             struct ipv6_opt_hdr __user *newopt, int newoptlen,
                             int inherit,
@@ -628,6 +632,7 @@ ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt,
        if (!tot_len)
                return NULL;
 
+       tot_len += sizeof(*opt2);
        opt2 = sock_kmalloc(sk, tot_len, GFP_ATOMIC);
        if (!opt2)
                return ERR_PTR(-ENOBUFS);
@@ -668,7 +673,26 @@ ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt,
 
        return opt2;
 out:
-       sock_kfree_s(sk, p, tot_len);
+       sock_kfree_s(sk, opt2, opt2->tot_len);
        return ERR_PTR(err);
 }
 
+struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
+                                         struct ipv6_txoptions *opt)
+{
+       /*
+        * ignore the dest before srcrt unless srcrt is being included.
+        * --yoshfuji
+        */
+       if (opt && opt->dst0opt && !opt->srcrt) {
+               if (opt_space != opt) {
+                       memcpy(opt_space, opt, sizeof(*opt_space));
+                       opt = opt_space;
+               }
+               opt->opt_nflen -= ipv6_optlen(opt->dst0opt);
+               opt->dst0opt = NULL;
+       }
+
+       return opt;
+}
+