diff --git a/SOURCES/0003-nvmetcli-set-up-the-target-only-after-the-network-is.patch b/SOURCES/0003-nvmetcli-set-up-the-target-only-after-the-network-is.patch
new file mode 100644
index 0000000..f1a58ad
--- /dev/null
+++ b/SOURCES/0003-nvmetcli-set-up-the-target-only-after-the-network-is.patch
@@ -0,0 +1,39 @@
+From 0855bcec9a5a9ceba586a5a1e1a8742b85424870 Mon Sep 17 00:00:00 2001
+From: Maurizio Lombardi <mlombard@redhat.com>
+Date: Tue, 28 Feb 2023 17:36:15 +0100
+Subject: [PATCH] nvmetcli: set up the target only after the network is
+ configured
+
+network.target only indicates that the network stack is up, but it
+doesn't mean that the network devices have been configured.
+
+Replace it with network-online.target, this fixes the following
+error when systemd restores the target configuration during boot:
+
+[   19.613251] nvmet_tcp: failed to bind port socket -99
+[FAILED] Failed to start Restore NVMe kernel target configuration.
+
+Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
+Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+---
+ nvmet.service | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/nvmet.service b/nvmet.service
+index 5c7991e..6f97a91 100644
+--- a/nvmet.service
++++ b/nvmet.service
+@@ -1,7 +1,8 @@
+ [Unit]
+ Description=Restore NVMe kernel target configuration
+ Requires=sys-kernel-config.mount
+-After=sys-kernel-config.mount network.target local-fs.target
++After=sys-kernel-config.mount network-online.target local-fs.target
++Wants=network-online.target
+ 
+ [Service]
+ Type=oneshot
+-- 
+2.31.1
+
diff --git a/SPECS/nvmetcli.spec b/SPECS/nvmetcli.spec
index 6177774..699b1d7 100644
--- a/SPECS/nvmetcli.spec
+++ b/SPECS/nvmetcli.spec
@@ -3,11 +3,12 @@ License:        ASL 2.0
 Group:          Applications/System
 Summary:        An adminstration shell for NVMe storage targets
 Version:        0.7
-Release:        3%{?dist}
+Release:        5%{?dist}
 URL:            ftp://ftp.infradead.org/pub/nvmetcli/
 Source:         ftp://ftp.infradead.org/pub/nvmetcli/%{name}-%{version}.tar.gz
 Patch0:         0001-Documentation-fix-typo.patch
 Patch1:         0002-nvmetcli-don-t-remove-ANA-Group-1-on-clear.patch
+Patch2:         0003-nvmetcli-set-up-the-target-only-after-the-network-is.patch
 BuildArch:      noarch
 BuildRequires:  python3-devel python3-setuptools systemd-units asciidoc xmlto
 Requires:       python3-configshell python3-kmod
@@ -24,6 +25,7 @@ as well as saving / restoring the configuration to / from a json file.
 %setup -q
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 %build
 %{__python3} setup.py build
@@ -58,6 +60,12 @@ install -m 644 Documentation/nvmetcli.8.gz %{buildroot}%{_mandir}/man8/
 %{_mandir}/man8/nvmetcli.8.gz
 
 %changelog
+* Tue Apr 04 2023 Maurizio Lombardi <mlombard@redhat.com> - 0.7-5
+- Fix gating tests.
+
+* Tue Apr 04 2023 Maurizio Lombardi <mlombard@redhat.com> - 0.7-4
+- Fix BZ 2173777
+
 * Wed Apr 28 2021 Maurizio Lombardi <mlombard@redhat.com> - 0.7-3
 - Fix a failure when executing a clear command