summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohit Mehta <mohit@vyatta.com>2008-03-21 17:02:29 -0700
committerMohit Mehta <mohit@vyatta.com>2008-03-21 17:02:29 -0700
commitf279d69e1d3952de1231ecf56d6ebb3023b96645 (patch)
treebe3d4f36063c120379d54cfd836c0b637072919d
parent5d2be410b7f40309a83c52fe6a6b741a9fd781c8 (diff)
downloadvyatta-cfg-system-f279d69e1d3952de1231ecf56d6ebb3023b96645.tar.gz
vyatta-cfg-system-f279d69e1d3952de1231ecf56d6ebb3023b96645.zip
Fix Bug 3027 Unable to configure SNMP community client address
- added the following commands: - set protocols snmp community <txt> client <IPv4> - set protocols snmp community <txt> network <IPv4net>
-rw-r--r--scripts/snmp/vyatta-snmp.pl37
-rw-r--r--templates/protocols/snmp/community/node.tag/client/node.def3
-rw-r--r--templates/protocols/snmp/community/node.tag/network/node.def4
3 files changed, 38 insertions, 6 deletions
diff --git a/scripts/snmp/vyatta-snmp.pl b/scripts/snmp/vyatta-snmp.pl
index f12bcc45..0301a041 100644
--- a/scripts/snmp/vyatta-snmp.pl
+++ b/scripts/snmp/vyatta-snmp.pl
@@ -74,12 +74,37 @@ sub snmp_get_values {
my @communities = $config->listNodes();
foreach my $community (@communities) {
- my $authorization = $config->returnValue("$community authorization");
- if (defined $authorization and $authorization eq "rw") {
- $output .= "rwcommunity $community\n";
- } else {
- $output .= "rocommunity $community\n";
- }
+ my $authorization = $config->returnValue("$community authorization");
+ my @clients = $config->returnValues("$community client");
+ my @networks = $config->returnValues("$community network");
+
+ if (scalar(@clients) == 0 and scalar(@networks) == 0){
+ if (defined $authorization and $authorization eq "rw") {
+ $output .= "rwcommunity $community\n";
+ } else {
+ $output .= "rocommunity $community\n";
+ }
+ } else {
+ if (scalar(@clients) != 0){
+ foreach my $client (@clients){
+ if (defined $authorization and $authorization eq "rw") {
+ $output .= "rwcommunity $community $client\n";
+ } else {
+ $output .= "rocommunity $community $client\n";
+ }
+ }
+ }
+ if (scalar(@networks) != 0){
+ foreach my $network (@networks){
+ if (defined $authorization and $authorization eq "rw") {
+ $output .= "rwcommunity $community $network\n";
+ } else {
+ $output .= "rocommunity $community $network\n";
+ }
+
+ }
+ }
+ }
}
$config->setLevel("protocols snmp");
diff --git a/templates/protocols/snmp/community/node.tag/client/node.def b/templates/protocols/snmp/community/node.tag/client/node.def
new file mode 100644
index 00000000..134698ef
--- /dev/null
+++ b/templates/protocols/snmp/community/node.tag/client/node.def
@@ -0,0 +1,3 @@
+multi:
+type: ipv4
+help: IP address of SNMP client allowed to contact system
diff --git a/templates/protocols/snmp/community/node.tag/network/node.def b/templates/protocols/snmp/community/node.tag/network/node.def
new file mode 100644
index 00000000..1afdb2a1
--- /dev/null
+++ b/templates/protocols/snmp/community/node.tag/network/node.def
@@ -0,0 +1,4 @@
+multi:
+type: ipv4net
+help: Subnet of SNMP client(s) allowed to contact system
+syntax:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --check-prefix-boundry $VAR(@)"