]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge git://git.skbuff.net/gitroot/yoshfuji/linux-2.6.14+advapi-fix/
authorDavid S. Miller <davem@sunset.davemloft.net>
Mon, 21 Nov 2005 04:52:16 +0000 (20:52 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Mon, 21 Nov 2005 04:52:16 +0000 (20:52 -0800)
include/net/ipv6.h
net/ipv6/datagram.c
net/ipv6/exthdrs.c
net/ipv6/ip6_flowlabel.c
net/ipv6/raw.c
net/ipv6/udp.c

index 6addb4d464d6c87b0b7d9ae2884c46e57c2e8737..0a2ad51cff8223dd1936e958a498d6dbd8644b2d 100644 (file)
@@ -237,6 +237,8 @@ extern struct ipv6_txoptions *      ipv6_renew_options(struct sock *sk, struct ipv6_t
                                                   int newtype,
                                                   struct ipv6_opt_hdr __user *newopt,
                                                   int newoptlen);
+struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
+                                         struct ipv6_txoptions *opt);
 
 extern int ip6_frag_nqueues;
 extern atomic_t ip6_frag_mem;
index cc518405b3e1efc29b87aea3cadb4e0c6d60068f..c4a3a993acb7ba5945f422bfa27c7b97d45376e0 100644 (file)
@@ -437,7 +437,7 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
                                break;
                        case IPPROTO_AH:
                                nexthdr = ptr[0];
-                               len = (ptr[1] + 1) << 2;
+                               len = (ptr[1] + 2) << 2;
                                break;
                        default:
                                nexthdr = ptr[0];
index 922549581abc266100d6a3a28676665dd509f858..be6faf311387ce8d6f5adf1b7ec251b5b89752f2 100644 (file)
@@ -628,6 +628,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 +669,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;
+}
+
index bbbe80cdaf72a75a463aff9551e60b31e2f69061..1cf02765fb5cae2ed7882149122dd3c9996197e4 100644 (file)
@@ -225,20 +225,16 @@ struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_space,
                                         struct ip6_flowlabel * fl,
                                         struct ipv6_txoptions * fopt)
 {
-       struct ipv6_txoptions * fl_opt = fl ? fl->opt : NULL;
-
-       if (fopt == NULL || fopt->opt_flen == 0) {
-               if (!fl_opt || !fl_opt->dst0opt || fl_opt->srcrt)
-                       return fl_opt;
-       }
-
+       struct ipv6_txoptions * fl_opt = fl->opt;
+       
+       if (fopt == NULL || fopt->opt_flen == 0)
+               return fl_opt;
+       
        if (fl_opt != NULL) {
                opt_space->hopopt = fl_opt->hopopt;
-               opt_space->dst0opt = fl_opt->srcrt ? fl_opt->dst0opt : NULL;
+               opt_space->dst0opt = fl_opt->dst0opt;
                opt_space->srcrt = fl_opt->srcrt;
                opt_space->opt_nflen = fl_opt->opt_nflen;
-               if (fl_opt->dst0opt && !fl_opt->srcrt)
-                       opt_space->opt_nflen -= ipv6_optlen(fl_opt->dst0opt);
        } else {
                if (fopt->opt_nflen == 0)
                        return fopt;
index 8e9628f1c4c5b4bc4f1b858c339950072ad50c7c..a66900cda2afc79273b2722c9e6d755a9b8725f9 100644 (file)
@@ -748,7 +748,9 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
        }
        if (opt == NULL)
                opt = np->opt;
-       opt = fl6_merge_options(&opt_space, flowlabel, opt);
+       if (flowlabel)
+               opt = fl6_merge_options(&opt_space, flowlabel, opt);
+       opt = ipv6_fixup_options(&opt_space, opt);
 
        fl.proto = proto;
        rawv6_probe_proto_opt(&fl, msg);
index e671153b47b250b9a7d10b2500dc15101c010fc7..5cc8731eb55b8585a75dfc97ea2226b565e75956 100644 (file)
@@ -771,7 +771,9 @@ do_udp_sendmsg:
        }
        if (opt == NULL)
                opt = np->opt;
-       opt = fl6_merge_options(&opt_space, flowlabel, opt);
+       if (flowlabel)
+               opt = fl6_merge_options(&opt_space, flowlabel, opt);
+       opt = ipv6_fixup_options(&opt_space, opt);
 
        fl->proto = IPPROTO_UDP;
        ipv6_addr_copy(&fl->fl6_dst, daddr);