diff options
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index eb29c2f5bcea..fc4f72686705 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -627,7 +627,7 @@ static void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb) | |||
627 | net = sk ? sock_net(sk) : dev_net(skb_dst(skb)->dev); | 627 | net = sk ? sock_net(sk) : dev_net(skb_dst(skb)->dev); |
628 | #ifdef CONFIG_TCP_MD5SIG | 628 | #ifdef CONFIG_TCP_MD5SIG |
629 | hash_location = tcp_parse_md5sig_option(th); | 629 | hash_location = tcp_parse_md5sig_option(th); |
630 | if (sk) { | 630 | if (sk && sk_fullsock(sk)) { |
631 | key = tcp_md5_do_lookup(sk, (union tcp_md5_addr *) | 631 | key = tcp_md5_do_lookup(sk, (union tcp_md5_addr *) |
632 | &ip_hdr(skb)->saddr, AF_INET); | 632 | &ip_hdr(skb)->saddr, AF_INET); |
633 | } else if (hash_location) { | 633 | } else if (hash_location) { |
@@ -674,7 +674,8 @@ static void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb) | |||
674 | ip_hdr(skb)->saddr, /* XXX */ | 674 | ip_hdr(skb)->saddr, /* XXX */ |
675 | arg.iov[0].iov_len, IPPROTO_TCP, 0); | 675 | arg.iov[0].iov_len, IPPROTO_TCP, 0); |
676 | arg.csumoffset = offsetof(struct tcphdr, check) / 2; | 676 | arg.csumoffset = offsetof(struct tcphdr, check) / 2; |
677 | arg.flags = (sk && inet_sk(sk)->transparent) ? IP_REPLY_ARG_NOSRCCHECK : 0; | 677 | arg.flags = (sk && inet_sk_transparent(sk)) ? IP_REPLY_ARG_NOSRCCHECK : 0; |
678 | |||
678 | /* When socket is gone, all binding information is lost. | 679 | /* When socket is gone, all binding information is lost. |
679 | * routing might fail in this case. No choice here, if we choose to force | 680 | * routing might fail in this case. No choice here, if we choose to force |
680 | * input interface, we will misroute in case of asymmetric route. | 681 | * input interface, we will misroute in case of asymmetric route. |
@@ -682,6 +683,9 @@ static void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb) | |||
682 | if (sk) | 683 | if (sk) |
683 | arg.bound_dev_if = sk->sk_bound_dev_if; | 684 | arg.bound_dev_if = sk->sk_bound_dev_if; |
684 | 685 | ||
686 | BUILD_BUG_ON(offsetof(struct sock, sk_bound_dev_if) != | ||
687 | offsetof(struct inet_timewait_sock, tw_bound_dev_if)); | ||
688 | |||
685 | arg.tos = ip_hdr(skb)->tos; | 689 | arg.tos = ip_hdr(skb)->tos; |
686 | ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk), | 690 | ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk), |
687 | skb, &TCP_SKB_CB(skb)->header.h4.opt, | 691 | skb, &TCP_SKB_CB(skb)->header.h4.opt, |
@@ -1705,7 +1709,9 @@ do_time_wait: | |||
1705 | tcp_v4_timewait_ack(sk, skb); | 1709 | tcp_v4_timewait_ack(sk, skb); |
1706 | break; | 1710 | break; |
1707 | case TCP_TW_RST: | 1711 | case TCP_TW_RST: |
1708 | goto no_tcp_socket; | 1712 | tcp_v4_send_reset(sk, skb); |
1713 | inet_twsk_deschedule_put(inet_twsk(sk)); | ||
1714 | goto discard_it; | ||
1709 | case TCP_TW_SUCCESS:; | 1715 | case TCP_TW_SUCCESS:; |
1710 | } | 1716 | } |
1711 | goto discard_it; | 1717 | goto discard_it; |