diff --git a/SOURCES/openssh-8.0p1-ipv6-process.patch b/SOURCES/openssh-8.0p1-ipv6-process.patch
new file mode 100644
index 0000000..cb76938
--- /dev/null
+++ b/SOURCES/openssh-8.0p1-ipv6-process.patch
@@ -0,0 +1,27 @@
+diff --git a/sftp.c b/sftp.c
+index 04881c83..03c7a5c7 100644
+--- a/sftp.c
++++ b/sftp.c
+@@ -2527,12 +2527,17 @@ main(int argc, char **argv)
+ 				port = tmp;
+ 			break;
+ 		default:
++			/* Try with user, host and path. */
+ 			if (parse_user_host_path(*argv, &user, &host,
+-			    &file1) == -1) {
+-				/* Treat as a plain hostname. */
+-				host = xstrdup(*argv);
+-				host = cleanhostname(host);
+-			}
++			    &file1) == 0)
++				break;
++			/* Try with user and host. */
++			if (parse_user_host_port(*argv, &user, &host, NULL)
++			    == 0)
++				break;
++			/* Treat as a plain hostname. */
++			host = xstrdup(*argv);
++			host = cleanhostname(host);
+ 			break;
+ 		}
+ 		file2 = *(argv + 1);
diff --git a/SPECS/openssh.spec b/SPECS/openssh.spec
index bf9c10f..34a50f0 100644
--- a/SPECS/openssh.spec
+++ b/SPECS/openssh.spec
@@ -66,7 +66,7 @@
 
 # Do not forget to bump pam_ssh_agent_auth release if you rewind the main package release to 1
 %global openssh_ver 8.0p1
-%global openssh_rel 16
+%global openssh_rel 17
 %global pam_ssh_agent_ver 0.10.3
 %global pam_ssh_agent_rel 7
 
@@ -272,6 +272,8 @@ Patch984: openssh-8.0p1-crypto-policy-doc.patch
 # 0fa33683223c76289470a954404047bc762be84c
 # f8df0413f0a057b6a3d3dd7bd8bc7c5d80911d3a
 Patch985: openssh-8.7p1-minimize-sha1-use.patch
+# Upstream 25e3bccbaa63d27b9d5e09c123f1eb28594d2bd6
+Patch987: openssh-8.0p1-ipv6-process.patch
 
 License: BSD
 Group: Applications/Internet
@@ -503,6 +505,7 @@ popd
 %patch983 -p1 -b .sftp-realpath
 %patch984 -p1 -b .crypto-policy-doc
 %patch985 -p1 -b .minimize-sha1-use
+%patch987 -p1 -b .sftp_ipv6
 
 %patch200 -p1 -b .audit
 %patch201 -p1 -b .audit-race
@@ -794,6 +797,9 @@ getent passwd sshd >/dev/null || \
 %endif
 
 %changelog
+* Mon Jan 23 2023 Dmitry Belyavskiy <dbelyavs@redhat.com> - 8.0p1-17
+- Fix parsing of IPv6 IPs in sftp client (#2162733)
+
 * Wed Jun 29 2022 Zoltan Fridrich <zfridric@redhat.com> - 8.0p1-16
 - Omit client side from minimize-sha1-use.patch to prevent regression (#2093897)