summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-03-10 12:08:28 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-03-10 12:08:28 -0700
commit97eb8fb353ec70109ea96ca1730a886761b5bc9f (patch)
tree658e6ded2dd1b1781ad02242aea2be2061a04253 /scripts
parent65c2cc38cc770551f34e6e00162256024c6a90c1 (diff)
parentebca7579f5d946d1e5d81c3c4ddc338dda0f7939 (diff)
downloadvyatta-op-97eb8fb353ec70109ea96ca1730a886761b5bc9f.tar.gz
vyatta-op-97eb8fb353ec70109ea96ca1730a886761b5bc9f.zip
Merge branch 'glendale' of suva.vyatta.com:/git/vyatta-op into glendale
Diffstat (limited to 'scripts')
-rw-r--r--scripts/vyatta-show-interfaces.pl13
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/vyatta-show-interfaces.pl b/scripts/vyatta-show-interfaces.pl
index 6e9c0e5..092f147 100644
--- a/scripts/vyatta-show-interfaces.pl
+++ b/scripts/vyatta-show-interfaces.pl
@@ -27,6 +27,7 @@ use lib "/opt/vyatta/share/perl5/";
use VyattaConfig;
use Getopt::Long;
use POSIX;
+use NetAddr::IP;
use strict;
use warnings;
@@ -154,11 +155,15 @@ sub get_ipaddr {
my $intf = shift;
my @addr_list = ();
- my @lines = `ip addr show $intf | grep 'inet '`;
+ my @lines = `ip addr show $intf | grep 'inet' | grep -iv 'fe80'`;
foreach my $line (@lines) {
- if ($line =~ m/inet (\d+\.\d+\.\d+\.\d+)\/(\d+)/) {
- push @addr_list, "$1/$2";
- }
+ (my $inet, my $addr, my $remainder) = split(' ', $line, 3);
+ my $ip = new NetAddr::IP($addr);
+ if ($ip->version() == 6) {
+ push @addr_list, $ip->short() . '/' . $ip->masklen();
+ } else {
+ push @addr_list, $ip->cidr();
+ }
}
chomp @addr_list;
return @addr_list;