diff --git a/src/api2/config/network.rs b/src/api2/config/network.rs index 69df0670..9c348513 100644 --- a/src/api2/config/network.rs +++ b/src/api2/config/network.rs @@ -80,6 +80,14 @@ pub fn read_interface(name: String) -> Result { name: { schema: NETWORK_INTERFACE_NAME_SCHEMA, }, + method_v4: { + type: NetworkConfigMethod, + optional: true, + }, + method_v6: { + type: NetworkConfigMethod, + optional: true, + }, address: { schema: CIDR_SCHEMA, optional: true, @@ -101,6 +109,8 @@ pub fn read_interface(name: String) -> Result { /// Update network interface config. pub fn update_interface( name: String, + method_v4: Option, + method_v6: Option, address: Option, gateway: Option, digest: Option, @@ -117,6 +127,9 @@ pub fn update_interface( let interface = config.lookup_mut(&name)?; + if method_v4.is_some() { interface.method_v4 = method_v4; } + if method_v6.is_some() { interface.method_v6 = method_v6; } + if let Some(address) = address { let (_, _, is_v6) = network::parse_cidr(&address)?; if is_v6 {