diff options
author | Mohit Mehta <mohit.mehta@vyatta.com> | 2008-11-11 12:05:50 -0800 |
---|---|---|
committer | Mohit Mehta <mohit.mehta@vyatta.com> | 2008-11-11 12:05:50 -0800 |
commit | 728cb6cbb7d5ac96342bd1ee6dd17297222adbd4 (patch) | |
tree | 17eeeca280b548f01d2c6c245a58e6ebcb0b3d67 | |
parent | a88c5c7db948dbf6e326f71c8b5616d94bfaf1a8 (diff) | |
download | vyatta-op-728cb6cbb7d5ac96342bd1ee6dd17297222adbd4.tar.gz vyatta-op-728cb6cbb7d5ac96342bd1ee6dd17297222adbd4.zip |
add 'ppp interface-name' to output of 'show dns forwarding nameserver'
for nameservers received from peer when ppp interface comes up
-rw-r--r-- | scripts/vyatta-op-dns-forwarding.pl | 32 |
1 files 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"; |