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:36:45 +0000 (15:36 -0400)
commitdc43f7e807a8bd9cc7deecf1980fcb3349477646
tree08a7f782adbaa03b353810ca04d87f7ca8b32344
parentfea864489c90a07e7e84f8f6f5c531b313ad6593
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