diff --git a/rust/src/lib/nm/query_apply/ip.rs b/rust/src/lib/nm/query_apply/ip.rs index 095dfb279e..c7eafd08fd 100644 --- a/rust/src/lib/nm/query_apply/ip.rs +++ b/rust/src/lib/nm/query_apply/ip.rs @@ -93,7 +93,16 @@ pub(crate) fn nm_ip_setting_to_nmstate6( | NmSettingIpMethod::Shared => (true, Some(false), Some(false)), NmSettingIpMethod::Auto => (true, Some(true), Some(true)), NmSettingIpMethod::Dhcp => (true, Some(true), Some(false)), - NmSettingIpMethod::Ignore => (true, Some(false), Some(false)), + NmSettingIpMethod::Ignore => { + log::debug!( + "Found NmSettingIpMethod::Ignore for ipv6, \ + reply on nispor for setting IPv6 query" + ); + return InterfaceIpv6 { + enabled_defined: false, + ..Default::default() + }; + } }; let (auto_dns, auto_gateway, auto_routes, auto_table_id) = parse_dhcp_opts(nm_ip_setting); diff --git a/tests/integration/nm/ip_test.py b/tests/integration/nm/ip_test.py index dd742d4e6a..9aebba4533 100644 --- a/tests/integration/nm/ip_test.py +++ b/tests/integration/nm/ip_test.py @@ -6,10 +6,12 @@ from libnmstate.schema import Interface from libnmstate.schema import InterfaceIPv4 from libnmstate.schema import InterfaceIPv6 +from libnmstate.schema import InterfaceState from libnmstate.schema import InterfaceType from ..testlib import cmdlib from ..testlib import assertlib +from ..testlib.statelib import show_only IPV4_ADDRESS1 = "192.0.2.251" @@ -223,3 +225,34 @@ def test_fix_dhcp_timeout_even_not_desired(dummy1_with_small_dhcp_timeout): ) == I32_MAX ) + + +@pytest.fixture +def eth1_up_ipv6_flushed_with_method_ignore(eth1_up): + libnmstate.apply( + { + Interface.KEY: [ + { + Interface.NAME: "eth1", + Interface.STATE: InterfaceState.UP, + Interface.IPV6: { + InterfaceIPv6.ENABLED: False, + }, + } + ], + } + ) + + cmdlib.exec_cmd( + "nmcli c modify eth1 ipv6.method ignore".split(), check=True + ) + cmdlib.exec_cmd("nmcli c up eth1".split(), check=True) + cmdlib.exec_cmd("ip -6 addr flush dev eth1".split(), check=True) + + +def test_delegate_nm_ipv6_method_ignore_to_nispor( + eth1_up_ipv6_flushed_with_method_ignore, +): + state = show_only(("eth1",)) + + assert not state[Interface.KEY][0][Interface.IPV6][InterfaceIPv6.ENABLED]