Jelajahi Sumber

tcp: md5: using remote adress for md5 lookup in rst packet

md5 key is added in socket through remote address.
remote address should be used in finding md5 key when
sending out reset packet.

Signed-off-by: shawnlu <shawn.lu@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
shawnlu 13 tahun lalu
induk
melakukan
8a622e71f5
2 mengubah file dengan 2 tambahan dan 2 penghapusan
  1. 1 1
      net/ipv4/tcp_ipv4.c
  2. 1 1
      net/ipv6/tcp_ipv6.c

+ 1 - 1
net/ipv4/tcp_ipv4.c

@@ -631,7 +631,7 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
 	arg.iov[0].iov_len  = sizeof(rep.th);
 	arg.iov[0].iov_len  = sizeof(rep.th);
 
 
 #ifdef CONFIG_TCP_MD5SIG
 #ifdef CONFIG_TCP_MD5SIG
-	key = sk ? tcp_v4_md5_do_lookup(sk, ip_hdr(skb)->daddr) : NULL;
+	key = sk ? tcp_v4_md5_do_lookup(sk, ip_hdr(skb)->saddr) : NULL;
 	if (key) {
 	if (key) {
 		rep.opt[0] = htonl((TCPOPT_NOP << 24) |
 		rep.opt[0] = htonl((TCPOPT_NOP << 24) |
 				   (TCPOPT_NOP << 16) |
 				   (TCPOPT_NOP << 16) |

+ 1 - 1
net/ipv6/tcp_ipv6.c

@@ -1083,7 +1083,7 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
 
 
 #ifdef CONFIG_TCP_MD5SIG
 #ifdef CONFIG_TCP_MD5SIG
 	if (sk)
 	if (sk)
-		key = tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->daddr);
+		key = tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->saddr);
 #endif
 #endif
 
 
 	if (th->ack)
 	if (th->ack)