Commit 8467dda0 authored by Petr Malat's avatar Petr Malat Committed by Jakub Kicinski
Browse files

sctp: Initialize daddr on peeled off socket



Function sctp_do_peeloff() wrongly initializes daddr of the original
socket instead of the peeled off socket, which makes getpeername()
return zeroes instead of the primary address. Initialize the new socket
instead.

Fixes: d570ee49 ("[SCTP]: Correctly set daddr for IPv6 sockets during peeloff")
Signed-off-by: default avatarPetr Malat <oss@malat.biz>
Acked-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Link: https://lore.kernel.org/r/20220409063611.673193-1-oss@malat.biz


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 65745da1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5636,7 +5636,7 @@ int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp)
	 * Set the daddr and initialize id to something more random and also
	 * copy over any ip options.
	 */
	sp->pf->to_sk_daddr(&asoc->peer.primary_addr, sk);
	sp->pf->to_sk_daddr(&asoc->peer.primary_addr, sock->sk);
	sp->pf->copy_ip_options(sk, sock->sk);

	/* Populate the fields of the newsk from the oldsk and migrate the