From bc7e2f59ab8a27af9624bbee715d19be4f947513 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 10 Nov 2008 09:56:32 -0800 Subject: Show correct statistics on slaves Statistics for slave devices were not being read properly. --- scripts/vyatta-show-bonding.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/vyatta-show-bonding.pl b/scripts/vyatta-show-bonding.pl index c3f5b01..2b7c8d6 100755 --- a/scripts/vyatta-show-bonding.pl +++ b/scripts/vyatta-show-bonding.pl @@ -95,10 +95,10 @@ sub show { foreach my $slave (@slaves) { printf $format, ' ' . $slave, - get_sysfs_value( $intf, "statistics/rx_bytes" ), - get_sysfs_value( $intf, "statistics/rx_packets" ), - get_sysfs_value( $intf, "statistics/tx_bytes" ), - get_sysfs_value( $intf, "statistics/tx_packets" ); + get_sysfs_value( $slave, "statistics/rx_bytes" ), + get_sysfs_value( $slave, "statistics/rx_packets" ), + get_sysfs_value( $slave, "statistics/tx_bytes" ), + get_sysfs_value( $slave, "statistics/tx_packets" ); } } } -- cgit v1.2.3 From 6b506130775b71f50a8ec8b8b635e224cb93125f Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 10 Nov 2008 17:10:08 -0800 Subject: Sort interfaces in bonding operational mode commands For consistency with show interfaces, sort output by device name --- scripts/vyatta-show-bonding.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/vyatta-show-bonding.pl b/scripts/vyatta-show-bonding.pl index 2b7c8d6..8a0daee 100755 --- a/scripts/vyatta-show-bonding.pl +++ b/scripts/vyatta-show-bonding.pl @@ -71,7 +71,7 @@ sub show_brief { my $format = "%-12s %-10s %-8s %-6s %s\n"; printf $format, 'Interface', 'Mode', 'State', 'Link', 'Slaves'; - foreach my $intf (@interfaces) { + foreach my $intf (sort @interfaces) { my $mode = get_sysfs_value( $intf, "bonding/mode" ); $mode =~ s/ [0-9]+$//; my ( $state, $link ) = get_state_link($intf); @@ -86,14 +86,14 @@ sub show { my $format = "%-16s %-10s %-10s %-10s %-10s\n"; printf $format, "Interface", "RX: bytes", "packets", "TX: bytes", "packets"; - foreach my $intf (@interfaces) { + foreach my $intf (sort @interfaces) { my @slaves = split( / /, get_sysfs_value( $intf, "bonding/slaves" ) ); printf $format, $intf, get_sysfs_value( $intf, "statistics/rx_bytes" ), get_sysfs_value( $intf, "statistics/rx_packets" ), get_sysfs_value( $intf, "statistics/tx_bytes" ), get_sysfs_value( $intf, "statistics/tx_packets" ); - foreach my $slave (@slaves) { + foreach my $slave (sort @slaves) { printf $format, ' ' . $slave, get_sysfs_value( $slave, "statistics/rx_bytes" ), get_sysfs_value( $slave, "statistics/rx_packets" ), -- cgit v1.2.3 From a88c5c7db948dbf6e326f71c8b5616d94bfaf1a8 Mon Sep 17 00:00:00 2001 From: Mohit Mehta Date: Mon, 10 Nov 2008 17:24:47 -0800 Subject: add wirelessmodem to interface hash to pick up description from CLI --- scripts/vyatta-show-interfaces.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/vyatta-show-interfaces.pl b/scripts/vyatta-show-interfaces.pl index 31ed90b..a776d65 100755 --- a/scripts/vyatta-show-interfaces.pl +++ b/scripts/vyatta-show-interfaces.pl @@ -46,6 +46,7 @@ my %intf_hash = ( adsl => 'adsl', multilink => 'ml', openvpn => 'vtun', + wirelessmodem => 'wlm', ); # -- cgit v1.2.3 From 728cb6cbb7d5ac96342bd1ee6dd17297222adbd4 Mon Sep 17 00:00:00 2001 From: Mohit Mehta Date: Tue, 11 Nov 2008 12:05:50 -0800 Subject: add 'ppp interface-name' to output of 'show dns forwarding nameserver' for nameservers received from peer when ppp interface comes up --- scripts/vyatta-op-dns-forwarding.pl | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/scripts/vyatta-op-dns-forwarding.pl b/scripts/vyatta-op-dns-forwarding.pl index 1f8f96d..bac1df3 100644 --- a/scripts/vyatta-op-dns-forwarding.pl +++ b/scripts/vyatta-op-dns-forwarding.pl @@ -125,7 +125,7 @@ sub get_dns_nameservers { my $nameserver = $split_line[1]; my $nameserver_via = "system"; if (@split_line > 2) { - my @dhclient_resolv_files = `ls /etc/resolv.conf.dhclient-new-*`; + my @dhclient_resolv_files = `ls /etc/resolv.conf.dhclient-new-* 2>/dev/null`; foreach my $each_dhcp_resolv_conf (@dhclient_resolv_files) { my @ns_dhclient_resolv=`grep "$nameserver\$" $each_dhcp_resolv_conf`; if ( @ns_dhclient_resolv > 0) { @@ -135,6 +135,20 @@ sub get_dns_nameservers { $nameserver_via = 'dhcp ' . $nameserver_via; } } + # check here if nameserver_via is still system, if yes then search /etc/ppp/resolv-interface.conf + if ($nameserver_via eq "system") { + my @ppp_resolv_files = `ls /etc/ppp/resolv-*conf 2>/dev/null`; + foreach my $each_ppp_resolv_conf (@ppp_resolv_files) { + my @ns_ppp_resolv=`grep "$nameserver\$" $each_ppp_resolv_conf`; + if ( @ns_ppp_resolv > 0) { + my @ppp_file_array = split(/-/, $each_ppp_resolv_conf); + @ppp_file_array = split(/\./, $ppp_file_array[1]); + $nameserver_via = $ppp_file_array[0]; + chomp $nameserver_via; + $nameserver_via = 'ppp ' . $nameserver_via; + } + } + } } $show_nameservers_output .= "$nameserver available via '$nameserver_via'\n"; } @@ -186,7 +200,7 @@ sub get_dns_nameservers { $show_nameservers_output .= "-----------------------------------------------\n"; } if (@resolv_conf_split_line > 2) { - my @dhclient_resolv_files = `ls /etc/resolv.conf.dhclient-new-*`; + my @dhclient_resolv_files = `ls /etc/resolv.conf.dhclient-new-* 2>/dev/null`; foreach my $each_dhcp_resolv_conf (@dhclient_resolv_files) { chomp $each_dhcp_resolv_conf; my @ns_dhclient_resolv=`grep "$resolv_conf_nameserver\$" $each_dhcp_resolv_conf`; @@ -197,6 +211,20 @@ sub get_dns_nameservers { $resolv_nameserver_via = 'dhcp ' . $resolv_nameserver_via; } } + # check here if resolv_nameserver_via is still system, if yes then search /etc/ppp/resolv-interface.conf + if ($resolv_nameserver_via eq "system") { + my @ppp_resolv_files = `ls /etc/ppp/resolv-*conf 2>/dev/null`; + foreach my $each_ppp_resolv_conf (@ppp_resolv_files) { + my @ns_ppp_resolv=`grep "$resolv_conf_nameserver\$" $each_ppp_resolv_conf`; + if ( @ns_ppp_resolv > 0) { + my @ppp_file_array = split(/-/, $each_ppp_resolv_conf); + @ppp_file_array = split(/\./, $ppp_file_array[1]); + $resolv_nameserver_via = $ppp_file_array[0]; + chomp $resolv_nameserver_via; + $resolv_nameserver_via = 'ppp ' . $resolv_nameserver_via; + } + } + } } $show_nameservers_output .= "$resolv_conf_nameserver available via '$resolv_nameserver_via'\n"; -- cgit v1.2.3