mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 11:46:19 +00:00
tcp: Use correct peer adr when copying MD5 keys
When the TCP connection handshake completes on the passive side, a variety of state must be set up in the "child" sock, including the key if MD5 authentication is being used. Fix TCP for both address families to label the key with the peer's destination address, rather than the address from the listening sock, which is usually the wildcard. Reported-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: John Dykstra <john.dykstra1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e3afe7b75e
commit
e547bc1ecc
2 changed files with 2 additions and 2 deletions
|
@ -1374,7 +1374,7 @@ struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
|
||||||
*/
|
*/
|
||||||
char *newkey = kmemdup(key->key, key->keylen, GFP_ATOMIC);
|
char *newkey = kmemdup(key->key, key->keylen, GFP_ATOMIC);
|
||||||
if (newkey != NULL)
|
if (newkey != NULL)
|
||||||
tcp_v4_md5_do_add(newsk, inet_sk(sk)->daddr,
|
tcp_v4_md5_do_add(newsk, newinet->daddr,
|
||||||
newkey, key->keylen);
|
newkey, key->keylen);
|
||||||
newsk->sk_route_caps &= ~NETIF_F_GSO_MASK;
|
newsk->sk_route_caps &= ~NETIF_F_GSO_MASK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1442,7 +1442,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
|
||||||
*/
|
*/
|
||||||
char *newkey = kmemdup(key->key, key->keylen, GFP_ATOMIC);
|
char *newkey = kmemdup(key->key, key->keylen, GFP_ATOMIC);
|
||||||
if (newkey != NULL)
|
if (newkey != NULL)
|
||||||
tcp_v6_md5_do_add(newsk, &inet6_sk(sk)->daddr,
|
tcp_v6_md5_do_add(newsk, &newnp->daddr,
|
||||||
newkey, key->keylen);
|
newkey, key->keylen);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue