summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-04-27 08:27:35 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-04-27 08:27:35 -0700
commit2f753503721cfb723a90d98e0ebb1089e5448532 (patch)
tree9f7d970c607c33a13c58cd96e120ebf702ff0289
parentaa438a2cc742600adc37b116f431fa7dc4af6828 (diff)
downloadvyatta-cfg-2f753503721cfb723a90d98e0ebb1089e5448532.tar.gz
vyatta-cfg-2f753503721cfb723a90d98e0ebb1089e5448532.zip
Add method to show configured mtu
-rwxr-xr-xscripts/vyatta-interfaces.pl11
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index 997230d..de5fa49 100755
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -46,7 +46,7 @@ use warnings;
my $dhcp_daemon = '/sbin/dhclient';
my ($eth_update, $eth_delete, $addr, $dev, $mac, $mac_update, $op_dhclient);
-my ($check_name, $show_names, $intf_cli_path, $vif_name, $warn_name);
+my ($check_name, $show_names, $intf_cli_path, $vif_name, $warn_name, $show_mtu);
sub usage {
print "Usage: $0 --dev=<interface> --check=<type>\n";
@@ -55,6 +55,7 @@ sub usage {
print " $0 --dev=<interface> --eth-addr-update=<aa:aa:aa:aa:aa:aa>\n";
print " $0 --dev=<interface> --eth-addr-delete=<aa:aa:aa:aa:aa:aa>\n";
print " $0 --dev=<interface> --valid-addr={<a.b.c.d>|dhcp}\n";
+ print " $0 --dev=<interface> --mtu\n";
print " $0 --show=<type>\n";
exit 1;
}
@@ -70,6 +71,7 @@ GetOptions("eth-addr-update=s" => \$eth_update,
"show=s" => \$show_names,
"vif=s" => \$vif_name,
"warn" => \$warn_name,
+ "mtu" => \$show_mtu,
) or usage();
update_eth_addrs($eth_update, $dev) if ($eth_update);
@@ -81,6 +83,7 @@ op_dhcp_command($op_dhclient, $dev) if ($op_dhclient);
is_valid_name($check_name, $dev) if ($check_name);
exists_name($dev) if ($warn_name);
show_interfaces($show_names) if ($show_names);
+show_mtu($dev) if ($show_mtu);
exit 0;
sub is_ip_configured {
@@ -152,6 +155,12 @@ sub get_mtu {
return $intf->mtu();
}
+sub show_mtu {
+ my $name = shift;
+ my $mtu = get_mtu($name);
+ print "$mtu\n" if $mtu;
+}
+
sub dhcp_update_config {
my ($conf_file, $intf) = @_;