diff --git a/rust/agama-lib/share/profile.schema.json b/rust/agama-lib/share/profile.schema.json index 088d089b92..1d9b10512e 100644 --- a/rust/agama-lib/share/profile.schema.json +++ b/rust/agama-lib/share/profile.schema.json @@ -58,6 +58,11 @@ "description": "Custom mac-address (can also be 'preserve', 'permanent', 'random' or 'stable')", "type": "string" }, + "mtu": { + "description": "Connection MTU", + "type": "integer", + "minimum": 0 + }, "method4": { "description": "IPv4 configuration method (e.g., 'auto')", "type": "string", diff --git a/rust/agama-lib/src/network/proxies.rs b/rust/agama-lib/src/network/proxies.rs index db7de278b1..9e1de983d3 100644 --- a/rust/agama-lib/src/network/proxies.rs +++ b/rust/agama-lib/src/network/proxies.rs @@ -112,6 +112,10 @@ trait Connection { fn mac_address(&self) -> zbus::Result; #[dbus_proxy(property)] fn set_mac_address(&self, mac_address: &str) -> zbus::Result<()>; + #[dbus_proxy(property)] + fn mtu(&self) -> zbus::Result; + #[dbus_proxy(property)] + fn set_mtu(&self, mtu: u32) -> zbus::Result<()>; } #[dbus_proxy( diff --git a/rust/agama-lib/src/network/settings.rs b/rust/agama-lib/src/network/settings.rs index 3e730f7e22..b78934f40e 100644 --- a/rust/agama-lib/src/network/settings.rs +++ b/rust/agama-lib/src/network/settings.rs @@ -103,6 +103,12 @@ pub struct NetworkConnection { pub mac_address: Option, #[serde(skip_serializing_if = "Option::is_none")] pub status: Option, + #[serde(skip_serializing_if = "is_zero", default)] + pub mtu: u32, +} + +fn is_zero(u: &u32) -> bool { + *u == 0 } impl NetworkConnection { diff --git a/rust/agama-server/src/network/model.rs b/rust/agama-server/src/network/model.rs index 9f5a49e571..51ad27fcf2 100644 --- a/rust/agama-server/src/network/model.rs +++ b/rust/agama-server/src/network/model.rs @@ -600,6 +600,7 @@ impl TryFrom for Connection { connection.ip_config.gateway4 = conn.gateway4; connection.ip_config.gateway6 = conn.gateway6; connection.interface = conn.interface; + connection.mtu = conn.mtu; Ok(connection) } @@ -620,6 +621,7 @@ impl TryFrom for NetworkConnection { let gateway6 = conn.ip_config.gateway6; let interface = conn.interface; let status = Some(conn.status); + let mtu = conn.mtu; let mut connection = NetworkConnection { id, @@ -632,6 +634,7 @@ impl TryFrom for NetworkConnection { mac_address, interface, addresses, + mtu, ..Default::default() };