Skip to content

Commit 26eea08

Browse files
christoph-zededarouming
authored andcommitted
netmonitor: timeout calling dhcpcd executable
Add a timeout when calling dhcpcd in case it hangs; this prevents the whole DPCManager from hanging and ultimatevely making the watchdog fire and reboot the system. Signed-off-by: Christoph Ostarek <[email protected]> (cherry picked from commit e628c59)
1 parent 11949f6 commit 26eea08

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/pillar/netmonitor/linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ func (m *LinuxNetworkMonitor) GetInterfaceDHCPInfo(ifIndex int) (info DHCPInfo,
257257
// XXX Getting error -1 unless we add argument -4.
258258
// XXX Add IPv6 support.
259259
m.Log.Functionf("Calling dhcpcd -U -4 %s\n", ifName)
260-
stdoutStderr, err := base.Exec(m.Log, "dhcpcd", "-U", "-4", ifName).CombinedOutput()
260+
stdoutStderr, err := base.Exec(m.Log, "dhcpcd", "-U", "-4", ifName).CombinedOutputWithTimeout()
261261
if err != nil {
262262
if strings.Contains(string(stdoutStderr), "dhcp_dump: No such file or directory") {
263263
// DHCP is not configured for this interface. Return empty DHCPInfo.

0 commit comments

Comments
 (0)