]> git.ipfire.org Git - people/stevee/guardian.git/blobdiff - modules/Base.pm
Add IPv6 support to IPtables module.
[people/stevee/guardian.git] / modules / Base.pm
index 1aa1d2f587d1287e337a11a7c825480db5e95b3e..f29f5432c67616ee624eaf7daa0bf9f81eb2d076 100644 (file)
@@ -4,7 +4,7 @@ use warnings;
 
 use Exporter qw(import);
 
-our @EXPORT_OK = qw(GenerateMonitoredFiles FilePositions);
+our @EXPORT_OK = qw(GenerateMonitoredFiles DetectIPProtocolVersion FilePositions);
 
 use Net::IP;
 
@@ -172,6 +172,22 @@ sub IPOrNet2Int($) {
        }
 }
 
+#
+## DetectIPProtocolVersion function.
+#
+## Wrapper function for determining the used protocol version (4/6)
+## for a given IP address.
+#
+sub DetectIPProtocolVersion ($) {
+       my $address = shift;
+
+       # Call external perl module to detect the used IP protocol version.
+       my $version = &Net::IP::ip_get_version($address);
+
+       # Return the detected version.
+       return $version;
+}
+
 #
 ## Function for fileposition initialization.
 #