]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - config/cfgroot/general-functions.pl
Merge remote-tracking branch 'stevee/proxy-squidclamav' into next
[ipfire-2.x.git] / config / cfgroot / general-functions.pl
index fbca601e4a62e2e31febfe24f66128b16d4335e4..41643d8d7451c25aebda2475600b0f9c170845a4 100644 (file)
@@ -1008,6 +1008,28 @@ sub MakeUserAgent() {
        return $user_agent;
 }
 
+sub RedIsWireless() {
+       # This function checks if a network device is a wireless device.
+
+       my %settings = ();
+       &readhash("${General::swroot}/ethernet/settings", \%settings);
+
+       # Find the name of the network device.
+       my $device = $settings{'RED_DEV'};
+
+       # Exit, if no device is configured.
+       return 0 if ($device eq "");
+
+       # Return 1 if the device is a wireless one.
+       my $path = "/sys/class/net/$device/wireless";
+       if (-d $path) {
+               return 1;
+       }
+
+       # Otherwise return zero.
+       return 0;
+}
+
 # Function to read a file with UTF-8 charset.
 sub read_file_utf8 ($) {
        my ($file) = @_;
@@ -1017,7 +1039,7 @@ sub read_file_utf8 ($) {
        my $all = <$in>;
        close $in;
 
-       return $all;    
+       return $all;
 }
 
 # Function to write a file with UTF-8 charset.