diff --git a/src/network/core_utils.rs b/src/network/core_utils.rs index 8638f98f4..c978906e8 100644 --- a/src/network/core_utils.rs +++ b/src/network/core_utils.rs @@ -282,7 +282,18 @@ impl CoreUtils { } Err(e) => return Err(e), } - ctl.set_value_string(val) + let result = ctl.set_value_string(val); + // if we have a read only /proc we ignore it as well + match result { + Ok(_) => result, + Err(SysctlError::IoError(e)) => { + if e.raw_os_error() == Some(libc::EROFS) { + return Ok(String::from("")); + } + return Err(e.into()); + }, + Err(err) => return Err(err), + } } } @@ -433,9 +444,6 @@ pub fn disable_ipv6_autoconf(if_name: &str) -> NetavarkResult<()> { // just ignore that case } - // if we have a read only /proc we ignore it as well - SysctlError::IoError(ref e) if e.raw_os_error() == Some(libc::EROFS) => {} - _ => { return Err(NetavarkError::wrap( "failed to set autoconf sysctl",