diff options
author | Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> | 2020-06-24 22:34:18 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-06-26 01:11:33 +0200 |
commit | 471e39df96b9a4c4ba88a2da9e25a126624d7a9c (patch) | |
tree | a06297f6b1d9cd3faf32b37b95d1fe01191209ed /net/sctp/protocol.c | |
parent | tc-testing: avoid action cookies with odd length. (diff) | |
download | linux-471e39df96b9a4c4ba88a2da9e25a126624d7a9c.tar.xz linux-471e39df96b9a4c4ba88a2da9e25a126624d7a9c.zip |
sctp: Don't advertise IPv4 addresses if ipv6only is set on the socket
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>
Diffstat (limited to '')
-rw-r--r-- | net/sctp/protocol.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 092d1afdee0d..cde29f3c7fb3 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c @@ -148,7 +148,8 @@ int sctp_copy_local_addr_list(struct net *net, struct sctp_bind_addr *bp, * sock as well as the remote peer. */ if (addr->a.sa.sa_family == AF_INET && - !(copy_flags & SCTP_ADDR4_PEERSUPP)) + (!(copy_flags & SCTP_ADDR4_ALLOWED) || + !(copy_flags & SCTP_ADDR4_PEERSUPP))) continue; if (addr->a.sa.sa_family == AF_INET6 && (!(copy_flags & SCTP_ADDR6_ALLOWED) || |