[IPV6]: Make fib6_node subtree depend on IPV6_SUBTREES
[powerpc.git] / net / ipv6 / tcp_ipv6.c
index 394bc54..c25e930 100644 (file)
@@ -720,10 +720,9 @@ static int tcp_v6_parse_md5_keys (struct sock *sk, char __user *optval,
                tp->md5sig_info = p;
        }
 
-       newkey = kmalloc(cmd.tcpm_keylen, GFP_KERNEL);
+       newkey = kmemdup(cmd.tcpm_key, cmd.tcpm_keylen, GFP_KERNEL);
        if (!newkey)
                return -ENOMEM;
-       memcpy(newkey, cmd.tcpm_key, cmd.tcpm_keylen);
        if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_MAPPED) {
                return tcp_v4_md5_do_add(sk, sin6->sin6_addr.s6_addr32[3],
                                         newkey, cmd.tcpm_keylen);
@@ -740,7 +739,7 @@ static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
        struct scatterlist sg[4];
        __u16 data_len;
        int block = 0;
-       __u16 cksum;
+       __sum16 cksum;
        struct tcp_md5sig_pool *hp;
        struct tcp6_pseudohdr *bp;
        struct hash_desc *desc;
@@ -930,11 +929,11 @@ static struct request_sock_ops tcp6_request_sock_ops __read_mostly = {
        .send_reset     =       tcp_v6_send_reset
 };
 
-struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = {
 #ifdef CONFIG_TCP_MD5SIG
+static struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = {
        .md5_lookup     =       tcp_v6_reqsk_md5_lookup,
-#endif
 };
+#endif
 
 static struct timewait_sock_ops tcp6_timewait_sock_ops = {
        .twsk_obj_size  = sizeof(struct tcp6_timewait_sock),
@@ -949,7 +948,7 @@ static void tcp_v6_send_check(struct sock *sk, int len, struct sk_buff *skb)
 
        if (skb->ip_summed == CHECKSUM_PARTIAL) {
                th->check = ~csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP,  0);
-               skb->csum = offsetof(struct tcphdr, check);
+               skb->csum_offset = offsetof(struct tcphdr, check);
        } else {
                th->check = csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, 
                                            csum_partial((char *)th, th->doff<<2, 
@@ -971,7 +970,7 @@ static int tcp_v6_gso_send_check(struct sk_buff *skb)
        th->check = 0;
        th->check = ~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr, skb->len,
                                     IPPROTO_TCP, 0);
-       skb->csum = offsetof(struct tcphdr, check);
+       skb->csum_offset = offsetof(struct tcphdr, check);
        skb->ip_summed = CHECKSUM_PARTIAL;
        return 0;
 }
@@ -1033,7 +1032,7 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
 
 #ifdef CONFIG_TCP_MD5SIG
        if (key) {
-               u32 *opt = (u32*)(t1 + 1);
+               __be32 *opt = (__be32*)(t1 + 1);
                opt[0] = htonl((TCPOPT_NOP << 24) |
                               (TCPOPT_NOP << 16) |
                               (TCPOPT_MD5SIG << 8) |
@@ -1503,12 +1502,10 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
                 * memory, then we end up not copying the key
                 * across. Shucks.
                 */
-               char *newkey = kmalloc(key->keylen, GFP_ATOMIC);
-               if (newkey) {
-                       memcpy(newkey, key->key, key->keylen);
+               char *newkey = kmemdup(key->key, key->keylen, GFP_ATOMIC);
+               if (newkey != NULL)
                        tcp_v6_md5_do_add(newsk, &inet6_sk(sk)->daddr,
                                          newkey, key->keylen);
-               }
        }
 #endif
 
@@ -1527,7 +1524,7 @@ out:
        return NULL;
 }
 
-static int tcp_v6_checksum_init(struct sk_buff *skb)
+static __sum16 tcp_v6_checksum_init(struct sk_buff *skb)
 {
        if (skb->ip_summed == CHECKSUM_COMPLETE) {
                if (!tcp_v6_check(skb->h.th,skb->len,&skb->nh.ipv6h->saddr,