src/config/network/parser.rs: corectly detect vanished interfaces
This commit is contained in:
parent
10a9be45bd
commit
96d9478668
|
@ -344,7 +344,10 @@ impl <R: BufRead> NetworkParser<R> {
|
||||||
for (iface, active) in existing_interfaces.iter() {
|
for (iface, active) in existing_interfaces.iter() {
|
||||||
if let Some(interface) = config.interfaces.get_mut(iface) {
|
if let Some(interface) = config.interfaces.get_mut(iface) {
|
||||||
interface.active = *active;
|
interface.active = *active;
|
||||||
} else if PHYSICAL_NIC_REGEX.is_match(iface) { // also add all physical NICs
|
if interface.interface_type == NetworkInterfaceType::Unknown {
|
||||||
|
interface.interface_type = NetworkInterfaceType::Ethernet;
|
||||||
|
}
|
||||||
|
} else if PHYSICAL_NIC_REGEX.is_match(iface) { // also add all physical NICs
|
||||||
let mut interface = Interface::new(iface.clone());
|
let mut interface = Interface::new(iface.clone());
|
||||||
interface.set_method_v4(NetworkConfigMethod::Manual)?;
|
interface.set_method_v4(NetworkConfigMethod::Manual)?;
|
||||||
interface.interface_type = NetworkInterfaceType::Ethernet;
|
interface.interface_type = NetworkInterfaceType::Ethernet;
|
||||||
|
@ -369,7 +372,7 @@ impl <R: BufRead> NetworkParser<R> {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if PHYSICAL_NIC_REGEX.is_match(name) {
|
if PHYSICAL_NIC_REGEX.is_match(name) {
|
||||||
interface.interface_type = NetworkInterfaceType::Ethernet;
|
interface.interface_type = NetworkInterfaceType::Vanished;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue