X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=blobdiff_plain;f=config%2Fcfgroot%2Fgeneral-functions.pl;h=3a04369e357a652b13985afd2dc9a91a996d3367;hp=a70f2673e6b4751cadb1530b6bd80c3aab5573e9;hb=61027579bbb5822d06ac41c7cdf259c49377b837;hpb=139e30d135846bcca03f1b1f1823780521fff1dd diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl index a70f2673e6..3a04369e35 100644 --- a/config/cfgroot/general-functions.pl +++ b/config/cfgroot/general-functions.pl @@ -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;