src/config/network.rs: use a single mtu setting (instead of mtu_v4 and mtu_v6)

This commit is contained in:
Dietmar Maurer
2020-04-23 07:07:14 +02:00
parent 4cb6bd894c
commit 2c18efd902
4 changed files with 29 additions and 41 deletions

View File

@ -156,7 +156,7 @@ impl <R: BufRead> NetworkParser<R> {
Ok(())
}
fn parse_iface_attributes(&mut self, interface: &mut Interface, family_v4: bool, family_v6: bool) -> Result<(), Error> {
fn parse_iface_attributes(&mut self, interface: &mut Interface) -> Result<(), Error> {
loop {
match self.peek()? {
@ -170,8 +170,7 @@ impl <R: BufRead> NetworkParser<R> {
Token::Gateway => self.parse_iface_gateway(interface)?,
Token::MTU => {
let mtu = self.parse_iface_mtu()?;
if family_v4 { interface.mtu_v4 = Some(mtu); }
if family_v6 { interface.mtu_v6 = Some(mtu); }
interface.mtu = Some(mtu);
}
Token::Netmask => bail!("netmask is deprecated and no longer supported"),
_ => {
@ -221,7 +220,7 @@ impl <R: BufRead> NetworkParser<R> {
interface.set_method_v6(config_method)?;
}
if has_attributes { self.parse_iface_attributes(&mut interface, address_family_v4, address_family_v6)?; }
if has_attributes { self.parse_iface_attributes(&mut interface)?; }
} else {
let mut interface = Interface::new(iface.clone());
if address_family_v4 {
@ -231,7 +230,7 @@ impl <R: BufRead> NetworkParser<R> {
interface.set_method_v6(config_method)?;
}
if has_attributes { self.parse_iface_attributes(&mut interface, address_family_v4, address_family_v6)?; }
if has_attributes { self.parse_iface_attributes(&mut interface)?; }
config.interfaces.insert(interface.name.clone(), interface);