src/config/network/parser.rs: corectly detect vanished interfaces

This commit is contained in:
Dietmar Maurer 2020-04-24 07:26:54 +02:00
parent 10a9be45bd
commit 96d9478668
1 changed files with 5 additions and 2 deletions

View File

@ -344,6 +344,9 @@ 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;
if interface.interface_type == NetworkInterfaceType::Unknown {
interface.interface_type = NetworkInterfaceType::Ethernet;
}
} else if PHYSICAL_NIC_REGEX.is_match(iface) { // also add all physical NICs } 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)?;
@ -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;
} }
} }