summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2011-03-08 09:47:13 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2011-03-08 09:47:13 -0800
commit5da52b67dc78ef08e7c8a0e1c5502a67be59cd27 (patch)
tree18099bd62e78a3d0675ffb057b4d478b3e68f383 /scripts
parent27e11cafcc7c1076747642d6fe92aed169d1ccbd (diff)
downloadvyatta-cfg-quagga-5da52b67dc78ef08e7c8a0e1c5502a67be59cd27.tar.gz
vyatta-cfg-quagga-5da52b67dc78ef08e7c8a0e1c5502a67be59cd27.zip
Test for ipv6 blacklist when configuring SNMP
Bug 6432 Since IPv6 can be disabled several ways and the config may not match the system, use socket to test if IPv6 is disabled.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/snmp/vyatta-snmp.pl15
1 files changed, 10 insertions, 5 deletions
diff --git a/scripts/snmp/vyatta-snmp.pl b/scripts/snmp/vyatta-snmp.pl
index 01283870..28d3d036 100755
--- a/scripts/snmp/vyatta-snmp.pl
+++ b/scripts/snmp/vyatta-snmp.pl
@@ -23,15 +23,17 @@
# **** End License ****
#
+use strict;
+use warnings;
+
use lib "/opt/vyatta/share/perl5/";
use Vyatta::Config;
use Vyatta::Misc;
use NetAddr::IP;
use Getopt::Long;
use File::Copy;
-
-use strict;
-use warnings;
+use Socket;
+use Socket6;
my $mibdir = '/opt/vyatta/share/snmp/mibs';
my $snmp_init = 'invoke-rc.d snmpd';
@@ -112,9 +114,12 @@ sub transport_syntax {
die "$addr: unknown IP version $version";
}
+# Test if IPv6 is possible by opening a socket
sub ipv6_disabled {
- my $config = new Vyatta::Config;
- return $config->exists("system ipv6 disable");
+ socket ( my $s, PF_INET6, SOCK_DGRAM, 0)
+ or return 1;
+ close($s);
+ return;
}
# Find SNMP agent listening addresses