aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/tcp_ipv6.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r--net/ipv6/tcp_ipv6.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index b6b356b7912a..8702b06cb60a 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -260,7 +260,8 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
260 if (final_p) 260 if (final_p)
261 ipv6_addr_copy(&fl.fl6_dst, final_p); 261 ipv6_addr_copy(&fl.fl6_dst, final_p);
262 262
263 if ((err = __xfrm_lookup(&dst, &fl, sk, XFRM_LOOKUP_WAIT)) < 0) { 263 err = __xfrm_lookup(sock_net(sk), &dst, &fl, sk, XFRM_LOOKUP_WAIT);
264 if (err < 0) {
264 if (err == -EREMOTE) 265 if (err == -EREMOTE)
265 err = ip6_dst_blackhole(sk, &dst, &fl); 266 err = ip6_dst_blackhole(sk, &dst, &fl);
266 if (err < 0) 267 if (err < 0)
@@ -390,7 +391,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
390 goto out; 391 goto out;
391 } 392 }
392 393
393 if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0) { 394 if ((err = xfrm_lookup(net, &dst, &fl, sk, 0)) < 0) {
394 sk->sk_err_soft = -err; 395 sk->sk_err_soft = -err;
395 goto out; 396 goto out;
396 } 397 }
@@ -492,7 +493,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req)
492 goto done; 493 goto done;
493 if (final_p) 494 if (final_p)
494 ipv6_addr_copy(&fl.fl6_dst, final_p); 495 ipv6_addr_copy(&fl.fl6_dst, final_p);
495 if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0) 496 if ((err = xfrm_lookup(sock_net(sk), &dst, &fl, sk, 0)) < 0)
496 goto done; 497 goto done;
497 498
498 skb = tcp_make_synack(sk, dst, req); 499 skb = tcp_make_synack(sk, dst, req);
@@ -501,7 +502,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req)
501 502
502 th->check = tcp_v6_check(th, skb->len, 503 th->check = tcp_v6_check(th, skb->len,
503 &treq->loc_addr, &treq->rmt_addr, 504 &treq->loc_addr, &treq->rmt_addr,
504 csum_partial((char *)th, skb->len, skb->csum)); 505 csum_partial(th, skb->len, skb->csum));
505 506
506 ipv6_addr_copy(&fl.fl6_dst, &treq->rmt_addr); 507 ipv6_addr_copy(&fl.fl6_dst, &treq->rmt_addr);
507 err = ip6_xmit(sk, skb, &fl, opt, 0); 508 err = ip6_xmit(sk, skb, &fl, opt, 0);
@@ -872,12 +873,10 @@ static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb)
872 873
873 if (genhash || memcmp(hash_location, newhash, 16) != 0) { 874 if (genhash || memcmp(hash_location, newhash, 16) != 0) {
874 if (net_ratelimit()) { 875 if (net_ratelimit()) {
875 printk(KERN_INFO "MD5 Hash %s for " 876 printk(KERN_INFO "MD5 Hash %s for (%pI6, %u)->(%pI6, %u)\n",
876 "(" NIP6_FMT ", %u)->"
877 "(" NIP6_FMT ", %u)\n",
878 genhash ? "failed" : "mismatch", 877 genhash ? "failed" : "mismatch",
879 NIP6(ip6h->saddr), ntohs(th->source), 878 &ip6h->saddr, ntohs(th->source),
880 NIP6(ip6h->daddr), ntohs(th->dest)); 879 &ip6h->daddr, ntohs(th->dest));
881 } 880 }
882 return 1; 881 return 1;
883 } 882 }
@@ -917,7 +916,7 @@ static void tcp_v6_send_check(struct sock *sk, int len, struct sk_buff *skb)
917 skb->csum_offset = offsetof(struct tcphdr, check); 916 skb->csum_offset = offsetof(struct tcphdr, check);
918 } else { 917 } else {
919 th->check = csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, 918 th->check = csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP,
920 csum_partial((char *)th, th->doff<<2, 919 csum_partial(th, th->doff<<2,
921 skb->csum)); 920 skb->csum));
922 } 921 }
923} 922}
@@ -999,7 +998,7 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win,
999 } 998 }
1000#endif 999#endif
1001 1000
1002 buff->csum = csum_partial((char *)t1, tot_len, 0); 1001 buff->csum = csum_partial(t1, tot_len, 0);
1003 1002
1004 memset(&fl, 0, sizeof(fl)); 1003 memset(&fl, 0, sizeof(fl));
1005 ipv6_addr_copy(&fl.fl6_dst, &ipv6_hdr(skb)->saddr); 1004 ipv6_addr_copy(&fl.fl6_dst, &ipv6_hdr(skb)->saddr);
@@ -1020,7 +1019,7 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win,
1020 * namespace 1019 * namespace
1021 */ 1020 */
1022 if (!ip6_dst_lookup(ctl_sk, &buff->dst, &fl)) { 1021 if (!ip6_dst_lookup(ctl_sk, &buff->dst, &fl)) {
1023 if (xfrm_lookup(&buff->dst, &fl, NULL, 0) >= 0) { 1022 if (xfrm_lookup(net, &buff->dst, &fl, NULL, 0) >= 0) {
1024 ip6_xmit(ctl_sk, buff, &fl, NULL, 0); 1023 ip6_xmit(ctl_sk, buff, &fl, NULL, 0);
1025 TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS); 1024 TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);
1026 if (rst) 1025 if (rst)
@@ -1318,7 +1317,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1318 if (final_p) 1317 if (final_p)
1319 ipv6_addr_copy(&fl.fl6_dst, final_p); 1318 ipv6_addr_copy(&fl.fl6_dst, final_p);
1320 1319
1321 if ((xfrm_lookup(&dst, &fl, sk, 0)) < 0) 1320 if ((xfrm_lookup(sock_net(sk), &dst, &fl, sk, 0)) < 0)
1322 goto out; 1321 goto out;
1323 } 1322 }
1324 1323
@@ -1831,7 +1830,7 @@ static int tcp_v6_init_sock(struct sock *sk)
1831 sk->sk_sndbuf = sysctl_tcp_wmem[1]; 1830 sk->sk_sndbuf = sysctl_tcp_wmem[1];
1832 sk->sk_rcvbuf = sysctl_tcp_rmem[1]; 1831 sk->sk_rcvbuf = sysctl_tcp_rmem[1];
1833 1832
1834 atomic_inc(&tcp_sockets_allocated); 1833 percpu_counter_inc(&tcp_sockets_allocated);
1835 1834
1836 return 0; 1835 return 0;
1837} 1836}
@@ -2045,6 +2044,7 @@ struct proto tcpv6_prot = {
2045 .sysctl_rmem = sysctl_tcp_rmem, 2044 .sysctl_rmem = sysctl_tcp_rmem,
2046 .max_header = MAX_TCP_HEADER, 2045 .max_header = MAX_TCP_HEADER,
2047 .obj_size = sizeof(struct tcp6_sock), 2046 .obj_size = sizeof(struct tcp6_sock),
2047 .slab_flags = SLAB_DESTROY_BY_RCU,
2048 .twsk_prot = &tcp6_timewait_sock_ops, 2048 .twsk_prot = &tcp6_timewait_sock_ops,
2049 .rsk_prot = &tcp6_request_sock_ops, 2049 .rsk_prot = &tcp6_request_sock_ops,
2050 .h.hashinfo = &tcp_hashinfo, 2050 .h.hashinfo = &tcp_hashinfo,