]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - config/cfgroot/general-functions.pl
Implement wireless client on RED.
[people/pmueller/ipfire-2.x.git] / config / cfgroot / general-functions.pl
index a70f2673e6b4751cadb1530b6bd80c3aab5573e9..3a04369e357a652b13985afd2dc9a91a996d3367 100644 (file)
@@ -980,4 +980,27 @@ sub GetIcmpDescription ($) {
     'Experimental');
     if ($index>41) {return 'unknown'} else {return @icmp_description[$index]};
 }
+
+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;