sctp: Don't advertise IPv4 addresses if ipv6only is set on the socket
authorMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Wed, 24 Jun 2020 20:34:18 +0000 (17:34 -0300)
committerSasha Levin <sashal@kernel.org>
Tue, 30 Jun 2020 19:38:39 +0000 (15:38 -0400)
commit5030f6682450a156ebcdea17f26e9a324bf73aec
tree45ff0287b3bbe0e9b5da72599a80042dd2c18e6d
parent05cc8235420a3c6ae1d2f9890cce7b46e591a3a4
sctp: Don't advertise IPv4 addresses if ipv6only is set on the socket

[ Upstream commit 471e39df96b9a4c4ba88a2da9e25a126624d7a9c ]

If a socket is set ipv6only, it will still send IPv4 addresses in the
INIT and INIT_ACK packets. This potentially misleads the peer into using
them, which then would cause association termination.

The fix is to not add IPv4 addresses to ipv6only sockets.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Tested-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/net/sctp/constants.h
net/sctp/associola.c
net/sctp/bind_addr.c
net/sctp/protocol.c