Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Aug 2021 15:30:25 GMT
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 784692c74019 - main - sctp: improve handling of IPv4 addresses on IPV6 sockets Reported by:	syzbot+08fe66e4bfc2777cba95@syzkaller.appspotmail.com MFC after:	3 days
Message-ID:  <202108071530.177FUPab051337@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=784692c74019fa69b5298fb1693a97f107c56b4b

commit 784692c74019fa69b5298fb1693a97f107c56b4b
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2021-08-07 15:27:56 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2021-08-07 15:27:56 +0000

    sctp: improve handling of IPv4 addresses on IPV6 sockets
    Reported by:    syzbot+08fe66e4bfc2777cba95@syzkaller.appspotmail.com
    MFC after:      3 days
---
 sys/netinet6/sctp6_usrreq.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c
index 6f5d639e6367..fcbb566b53d3 100644
--- a/sys/netinet6/sctp6_usrreq.c
+++ b/sys/netinet6/sctp6_usrreq.c
@@ -771,7 +771,8 @@ sctp6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr,
 			return (EINVAL);
 		}
 	}
-	if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
+	if ((addr->sa_family == AF_INET6) &&
+	    IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
 		struct sockaddr_in sin;
 
 		/* convert v4-mapped into v4 addr and send */
@@ -909,7 +910,8 @@ sctp6_connect(struct socket *so, struct sockaddr *addr, struct thread *p)
 			return (EINVAL);
 		}
 	}
-	if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
+	if ((addr->sa_family == AF_INET6) &&
+	    IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
 		/* convert v4-mapped into v4 addr */
 		in6_sin6_2_sin(&store.sin, sin6);
 		addr = &store.sa;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108071530.177FUPab051337>