Skip to content

Commit 8302887

Browse files
core: services: cable_guy: networksetup: dhclient should answer in less than 5 seconds
Otherwise will lock the entire service Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
1 parent f54e940 commit 8302887

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/services/cable_guy/networksetup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@ def _get_dhcp_address_using_dhclient(self, interface_name: str) -> str | None:
212212
"""
213213
try:
214214
# Just run dhclient without releasing existing IPs
215-
dhclient_output = os.popen(f"dhclient -v {interface_name} 2>&1").read()
215+
command = f"timeout 5 dhclient -v {interface_name} 2>&1"
216+
logger.info(f"Running: {command}")
217+
dhclient_output = os.popen(command).read()
216218

217219
bound_ip_match = re.search(r"bound to ([0-9.]+)", dhclient_output)
218220
if bound_ip_match:

0 commit comments

Comments
 (0)