[20/29] dhcpcd.exe: Run everything no matter how RED is configured

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

Commit Message

Michael Tremer Dec. 1, 2022, 5:23 p.m. UTC
  This could potentially create problems when we abuse these functions to
launch the DHCP client on IPTV interfaces. This would have to be tested
and confirmed or potentially we would need some more changes to keep
supporting that use-case, too.

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

Patch

diff --git a/src/initscripts/networking/dhcpcd.exe b/src/initscripts/networking/dhcpcd.exe
index 440a76693..f6e494f96 100644
--- a/src/initscripts/networking/dhcpcd.exe
+++ b/src/initscripts/networking/dhcpcd.exe
@@ -34,7 +34,6 @@  dhcpcd_up()
 		exit 0;
 	fi
 
-	# Only if RED_TYPE=DHCP update /var/ipfire/red
 	# Check if we have to restart the services at update
 	[ ! -e "/var/ipfire/red/active" ] && update=1;
 	if [ "$old_domain_name_service" != "$new_domain_name_service" ]; then
@@ -82,13 +81,12 @@  dhcpcd_down()
 	# Remove DNS servers
 	rm -f /var/run/dns1 /var/run/dns2
 
-	# Only if RED_TYPE=DHCP update /var/ipfire/red
-	if [ "$RED_TYPE" == "DHCP" ]; then
-		rm -f /var/ipfire/red/active
-		if [ ! $reason == "PREINIT" ]; then
-			logger -p local0.info -t dhcpcd.exe[$$] "${interface} has been brought down ($reason)"
-			run_subdir ${rc_base}/init.d/networking/red.down/
-		fi
+	# Consider RED to be no longer active
+	rm -f /var/ipfire/red/active
+
+	if [ ! $reason == "PREINIT" ]; then
+		logger -p local0.info -t dhcpcd.exe[$$] "${interface} has been brought down ($reason)"
+		run_subdir ${rc_base}/init.d/networking/red.down/
 	fi
 
 	# Remove any configured IP address from the device