diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-02-26 13:48:42 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-02-26 13:48:42 -0800 |
commit | d06e7889e624285f940caa44a92d988ffe3bdf75 (patch) | |
tree | e22be98cc827788f21c331440f8ea6ccab00556c | |
parent | 54eed88ccb65e52ff9aea8c7386c3ca4e1918762 (diff) | |
download | vyatta-cfg-d06e7889e624285f940caa44a92d988ffe3bdf75.tar.gz vyatta-cfg-d06e7889e624285f940caa44a92d988ffe3bdf75.zip |
Handle MTU on all types of interface
Use new Vyatta::Interface mtu function to handle all interface
types with DHCP.
-rwxr-xr-x | scripts/vyatta-interfaces.pl | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl index 5f3c5a9..8fce903 100755 --- a/scripts/vyatta-interfaces.pl +++ b/scripts/vyatta-interfaces.pl @@ -142,10 +142,9 @@ sub is_domain_name_set { } sub get_mtu { - my $intf = shift; - my $config = new Vyatta::Config; - $config->setLevel("interfaces $intf"); - return $config->returnValue("mtu"); + my $name = shift; + my $intf = new Vyatta::Interface($name); + return $intf->mtu(); } sub dhcp_update_config { @@ -164,19 +163,9 @@ sub dhcp_update_config { $output .= ", domain-name"; } - ## FIXME more code depending on name - my $mtu; - if ($intf =~ m/^eth[0-9]+$/) { - ## XXX what about vif? - $mtu = get_mtu("ethernet $intf"); - } elsif ($intf =~ m/^bond[0-9]+$/) { - $mtu = get_mtu("bonding $intf"); - } elsif ($intf =~ m/^br[0-9]+$/) { - ## bridge doesn't have mtu yet - $mtu = get_mtu("bridge $intf"); - } + my $mtu = get_mtu($intf); + $output .= ", interface-mtu" unless $mtu; - $mtu or $output .= ", interface-mtu"; $output .= ";\n"; $output .= "}\n\n"; |