diff options
-rw-r--r-- | scripts/vyatta-op-dns-forwarding.pl | 32 | ||||
-rwxr-xr-x | scripts/vyatta-show-bonding.pl | 14 | ||||
-rwxr-xr-x | scripts/vyatta-show-interfaces.pl | 1 |
3 files changed, 38 insertions, 9 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"; diff --git a/scripts/vyatta-show-bonding.pl b/scripts/vyatta-show-bonding.pl index c3f5b01..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,19 +86,19 @@ 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( $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" ); } } } 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', ); # |