Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/network/core_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,30 @@ impl CoreUtils {
}
};
tokio::spawn(_connection);

// make sure autoconf is off, we want manaully config only
if let Err(err) = CoreUtils::apply_sysctl_value(
format!("/proc/sys/net/ipv6/conf/{}/autoconf", ifname),
"0",
) {
match err {
SysctlError::NotFound(_) => {
// if the sysctl is not found we likely run on a system without ipv6
// 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(std::io::Error::new(
std::io::ErrorKind::Other,
format!("failed to set autoconf sysctl: {}", err),
));
}
}
};

// ip netns exec ip link set <ifname> up
if let Err(err) = CoreUtils::set_link_up(&handle, ifname).await {
return Err(err);
Expand Down
3 changes: 3 additions & 0 deletions test/300-macvlan.bats
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ function setup() {
run_in_container_netns ip r
assert "$output" "=~" "default via 10.88.0.1" "gateway must be there in default route"
assert_json "$result" ".podman.interfaces.eth0.subnets[0].gateway" == "10.88.0.1" "Result contains gateway address"

run_in_container_netns cat /proc/sys/net/ipv6/conf/eth0/autoconf
assert "0" "autoconf is disabled"
}

@test "macvlan setup with mtu" {
Expand Down