aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/tcp_ipv6.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index a25f4e8a8ada..66d04004afda 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -67,6 +67,9 @@
67#include <linux/proc_fs.h> 67#include <linux/proc_fs.h>
68#include <linux/seq_file.h> 68#include <linux/seq_file.h>
69 69
70/* Socket used for sending RSTs and ACKs */
71static struct socket *tcp6_socket;
72
70static void tcp_v6_send_reset(struct sk_buff *skb); 73static void tcp_v6_send_reset(struct sk_buff *skb);
71static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req); 74static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req);
72static void tcp_v6_send_check(struct sock *sk, int len, 75static void tcp_v6_send_check(struct sock *sk, int len,
@@ -611,7 +614,7 @@ static void tcp_v6_send_reset(struct sk_buff *skb)
611 if (!ip6_dst_lookup(NULL, &buff->dst, &fl)) { 614 if (!ip6_dst_lookup(NULL, &buff->dst, &fl)) {
612 615
613 if (xfrm_lookup(&buff->dst, &fl, NULL, 0) >= 0) { 616 if (xfrm_lookup(&buff->dst, &fl, NULL, 0) >= 0) {
614 ip6_xmit(NULL, buff, &fl, NULL, 0); 617 ip6_xmit(tcp6_socket->sk, buff, &fl, NULL, 0);
615 TCP_INC_STATS_BH(TCP_MIB_OUTSEGS); 618 TCP_INC_STATS_BH(TCP_MIB_OUTSEGS);
616 TCP_INC_STATS_BH(TCP_MIB_OUTRSTS); 619 TCP_INC_STATS_BH(TCP_MIB_OUTRSTS);
617 return; 620 return;
@@ -675,7 +678,7 @@ static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32
675 678
676 if (!ip6_dst_lookup(NULL, &buff->dst, &fl)) { 679 if (!ip6_dst_lookup(NULL, &buff->dst, &fl)) {
677 if (xfrm_lookup(&buff->dst, &fl, NULL, 0) >= 0) { 680 if (xfrm_lookup(&buff->dst, &fl, NULL, 0) >= 0) {
678 ip6_xmit(NULL, buff, &fl, NULL, 0); 681 ip6_xmit(tcp6_socket->sk, buff, &fl, NULL, 0);
679 TCP_INC_STATS_BH(TCP_MIB_OUTSEGS); 682 TCP_INC_STATS_BH(TCP_MIB_OUTSEGS);
680 return; 683 return;
681 } 684 }
@@ -1600,8 +1603,21 @@ static struct inet_protosw tcpv6_protosw = {
1600 1603
1601void __init tcpv6_init(void) 1604void __init tcpv6_init(void)
1602{ 1605{
1606 int err;
1607
1603 /* register inet6 protocol */ 1608 /* register inet6 protocol */
1604 if (inet6_add_protocol(&tcpv6_protocol, IPPROTO_TCP) < 0) 1609 if (inet6_add_protocol(&tcpv6_protocol, IPPROTO_TCP) < 0)
1605 printk(KERN_ERR "tcpv6_init: Could not register protocol\n"); 1610 printk(KERN_ERR "tcpv6_init: Could not register protocol\n");
1606 inet6_register_protosw(&tcpv6_protosw); 1611 inet6_register_protosw(&tcpv6_protosw);
1612
1613 err = sock_create_kern(PF_INET6, SOCK_RAW, IPPROTO_TCP, &tcp6_socket);
1614 if (err < 0)
1615 panic("Failed to create the TCPv6 control socket.\n");
1616 tcp6_socket->sk->sk_allocation = GFP_ATOMIC;
1617
1618 /* Unhash it so that IP input processing does not even
1619 * see it, we do not wish this socket to see incoming
1620 * packets.
1621 */
1622 tcp6_socket->sk->sk_prot->unhash(tcp6_socket->sk);
1607} 1623}