Skip to content

Commit 3781661

Browse files
committed
core, ipv6: enable optimistic_dad instead of completely disabling Duplicate Address Detection
We are disabling duplicate address detection for `ipv6` complelety which might not be needed so instead of setting `accept_dad` to `0` we can still do `optimistic_dad` to `1` for required interface. Some cons of using `optimistic_dad` * Might be still slower than disabling DAD. * Not good support for older kernels since it was added in later released of `3.x` Signed-off-by: Aditya R <arajan@redhat.com>
1 parent 17f896c commit 3781661

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/network/core_utils.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -799,11 +799,11 @@ impl CoreUtils {
799799
}
800800

801801
if ipv6_enabled {
802-
// Disable duplicate address detection if ipv6 enabled
802+
// Enable optimistic_dad on interface if ipv6 is enabled
803803
// Do not accept Router Advertisements if ipv6 is enabled
804-
let br_accept_dad = format!("/proc/sys/net/ipv6/conf/{}/accept_dad", ifname);
804+
let br_optimistic_dad = format!("/proc/sys/net/ipv6/conf/{}/optimistic_dad", ifname);
805805
let br_accept_ra = format!("net/ipv6/conf/{}/accept_ra", ifname);
806-
if let Err(e) = CoreUtils::apply_sysctl_value(&br_accept_dad, "0") {
806+
if let Err(e) = CoreUtils::apply_sysctl_value(&br_optimistic_dad, "1") {
807807
return Err(std::io::Error::new(
808808
std::io::ErrorKind::Other,
809809
format!("{}", e),
@@ -934,10 +934,10 @@ impl CoreUtils {
934934
}
935935

936936
if ipv6_enabled {
937-
// Disable dad inside the container too
938-
let disable_dad_in_container =
939-
format!("/proc/sys/net/ipv6/conf/{}/accept_dad", container_veth);
940-
if let Err(e) = CoreUtils::apply_sysctl_value(&disable_dad_in_container, "0") {
937+
// Enable optimistic_dad on interface if ipv6 is enabled
938+
let optimistic_dad_in_container =
939+
format!("/proc/sys/net/ipv6/conf/{}/optimistic_dad", container_veth);
940+
if let Err(e) = CoreUtils::apply_sysctl_value(&optimistic_dad_in_container, "1") {
941941
return Err(std::io::Error::new(
942942
std::io::ErrorKind::Other,
943943
format!("{}", e),
@@ -1095,8 +1095,8 @@ impl CoreUtils {
10951095
}
10961096
if ipv6_enabled {
10971097
// Disable duplicate address detection on host veth if ipv6 enabled
1098-
let k = format!("/proc/sys/net/ipv6/conf/{}/accept_dad", &host_veth);
1099-
match CoreUtils::apply_sysctl_value(&k, "0") {
1098+
let k = format!("/proc/sys/net/ipv6/conf/{}/optimistic_dad", &host_veth);
1099+
match CoreUtils::apply_sysctl_value(&k, "1") {
11001100
Ok(_) => {}
11011101
Err(err) => {
11021102
return Err(std::io::Error::new(

0 commit comments

Comments
 (0)