netcfg: interface enable/disable control (ip link set eth0 down/up)
LinkDevice trait gains is_enabled() and set_enabled() with defaults. EthernetLink stores enabled flag (default: true). When disabled, link_state() reports 'down' regardless of hardware_address presence. netcfg/ifaces/eth0/enabled is rw: cat /scheme/netcfg/ifaces/eth0/enabled → 'up' or 'down' echo up > .../enabled → bring interface up echo down > .../enabled → bring interface down echo on/off/1/0/yes/no → also accepted Mirrors Linux 'ip link set dev <state>'. Pre-existing link state (hardware_address Some/None) unchanged; the enabled flag adds a software override layer that can be toggled without restarting the netstack.
This commit is contained in:
@@ -59,6 +59,12 @@ pub trait LinkDevice {
|
||||
|
||||
fn set_mtu(&mut self, _mtu: usize) {}
|
||||
|
||||
fn is_enabled(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn set_enabled(&mut self, _enabled: bool) {}
|
||||
|
||||
fn link_state(&self) -> &'static str {
|
||||
"unknown"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user