]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - config/cfgroot/general-functions.pl
Merge remote-tracking branch 'stevee/wlan-client' into next
[people/teissler/ipfire-2.x.git] / config / cfgroot / general-functions.pl
index 90eacbdb011487e2f4af8e60eb8cc42e249f3620..3cdb36fbd4709229edd93b2f39893a145a17425f 100644 (file)
@@ -1008,4 +1008,26 @@ sub MakeUserAgent() {
        return $user_agent;
 }
 
        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;
+}
+
 1;
 1;