[13/29] dhcpcd.exe: Flush any configured IP addresses on shutdown

Message ID 20221201172318.3166615-13-michael.tremer@ipfire.org
State Accepted
Commit a22e3c8ec7e0411a6976fcc43dc132395e5cf0f7
Headers
Series [01/29] libgudev: New package |

Commit Message

Michael Tremer 1 Dec 2022, 5:23 p.m. UTC
  This allows us to start with a fresh interface every time dhcpcd is
being restarted.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
 src/initscripts/networking/dhcpcd.exe | 5 +++++
 1 file changed, 5 insertions(+)
  

Patch

diff --git a/src/initscripts/networking/dhcpcd.exe b/src/initscripts/networking/dhcpcd.exe
index be6d63708..f79d5d16d 100644
--- a/src/initscripts/networking/dhcpcd.exe
+++ b/src/initscripts/networking/dhcpcd.exe
@@ -84,6 +84,11 @@  dhcpcd_down()
 			run_subdir ${rc_base}/init.d/networking/red.down/
 		fi
 	fi
+
+	# Remove any configured IP address from the device
+	ip addr flush dev "${interface}" &>/dev/null
+
+	return 0
 }
 
 # Called when dhcpcd relies on a third party to configure an IP address