diff options
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index a3f72d7fc06c..d22f54482bab 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -683,7 +683,8 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb) | |||
683 | arg.bound_dev_if = sk->sk_bound_dev_if; | 683 | arg.bound_dev_if = sk->sk_bound_dev_if; |
684 | 684 | ||
685 | arg.tos = ip_hdr(skb)->tos; | 685 | arg.tos = ip_hdr(skb)->tos; |
686 | ip_send_unicast_reply(net, skb, &TCP_SKB_CB(skb)->header.h4.opt, | 686 | ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk), |
687 | skb, &TCP_SKB_CB(skb)->header.h4.opt, | ||
687 | ip_hdr(skb)->saddr, ip_hdr(skb)->daddr, | 688 | ip_hdr(skb)->saddr, ip_hdr(skb)->daddr, |
688 | &arg, arg.iov[0].iov_len); | 689 | &arg, arg.iov[0].iov_len); |
689 | 690 | ||
@@ -767,7 +768,8 @@ static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, u32 ack, | |||
767 | if (oif) | 768 | if (oif) |
768 | arg.bound_dev_if = oif; | 769 | arg.bound_dev_if = oif; |
769 | arg.tos = tos; | 770 | arg.tos = tos; |
770 | ip_send_unicast_reply(net, skb, &TCP_SKB_CB(skb)->header.h4.opt, | 771 | ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk), |
772 | skb, &TCP_SKB_CB(skb)->header.h4.opt, | ||
771 | ip_hdr(skb)->saddr, ip_hdr(skb)->daddr, | 773 | ip_hdr(skb)->saddr, ip_hdr(skb)->daddr, |
772 | &arg, arg.iov[0].iov_len); | 774 | &arg, arg.iov[0].iov_len); |
773 | 775 | ||
@@ -2428,14 +2430,39 @@ struct proto tcp_prot = { | |||
2428 | }; | 2430 | }; |
2429 | EXPORT_SYMBOL(tcp_prot); | 2431 | EXPORT_SYMBOL(tcp_prot); |
2430 | 2432 | ||
2433 | static void __net_exit tcp_sk_exit(struct net *net) | ||
2434 | { | ||
2435 | int cpu; | ||
2436 | |||
2437 | for_each_possible_cpu(cpu) | ||
2438 | inet_ctl_sock_destroy(*per_cpu_ptr(net->ipv4.tcp_sk, cpu)); | ||
2439 | free_percpu(net->ipv4.tcp_sk); | ||
2440 | } | ||
2441 | |||
2431 | static int __net_init tcp_sk_init(struct net *net) | 2442 | static int __net_init tcp_sk_init(struct net *net) |
2432 | { | 2443 | { |
2444 | int res, cpu; | ||
2445 | |||
2446 | net->ipv4.tcp_sk = alloc_percpu(struct sock *); | ||
2447 | if (!net->ipv4.tcp_sk) | ||
2448 | return -ENOMEM; | ||
2449 | |||
2450 | for_each_possible_cpu(cpu) { | ||
2451 | struct sock *sk; | ||
2452 | |||
2453 | res = inet_ctl_sock_create(&sk, PF_INET, SOCK_RAW, | ||
2454 | IPPROTO_TCP, net); | ||
2455 | if (res) | ||
2456 | goto fail; | ||
2457 | *per_cpu_ptr(net->ipv4.tcp_sk, cpu) = sk; | ||
2458 | } | ||
2433 | net->ipv4.sysctl_tcp_ecn = 2; | 2459 | net->ipv4.sysctl_tcp_ecn = 2; |
2434 | return 0; | 2460 | return 0; |
2435 | } | ||
2436 | 2461 | ||
2437 | static void __net_exit tcp_sk_exit(struct net *net) | 2462 | fail: |
2438 | { | 2463 | tcp_sk_exit(net); |
2464 | |||
2465 | return res; | ||
2439 | } | 2466 | } |
2440 | 2467 | ||
2441 | static void __net_exit tcp_sk_exit_batch(struct list_head *net_exit_list) | 2468 | static void __net_exit tcp_sk_exit_batch(struct list_head *net_exit_list) |