8c9155e5e9767a9958661a6e7a40a3d37a62068c
[project/luci.git] / contrib / package / meshwizard / files / usr / bin / meshwizard / helpers / gen_bssid.sh
1 #!/bin/sh
2 # create essid from channel, takes two args:
3 # $1 = channel (integer)
4 # $2 = community (optional)
5 channel=$1
6 community=$2
7
8 . /lib/functions.sh
9
10
11 # Try to get BSSID from profile first
12 config_load profile_$community
13 config_get bssid bssidscheme $channel
14 if [ -z "$bssid" ]; then
15         config_get bssid bssidscheme "all"
16 fi
17
18 if [ -z "$bssid" ]; then
19         case $channel in
20         [1-9])
21                 bssid="$(printf "%X\n" $channel)2:CA:FF:EE:BA:BE"
22                 ;;
23         1[0-4])
24                 bssid="$(printf "%X\n" $channel)2:CA:FF:EE:BA:BE"
25                 ;;
26         [3-9][0-9])
27                 bssid="00:$channel:CA:FF:EE:EE"
28                 ;;
29         1[0-9][0-9])
30                 bssid="${channel/1/01:}:CA:FF:EE:EE"
31                 ;;
32         *)      bssid="02:CA:FF:EE:BA:BE"
33                 ;;
34         esac
35 fi
36 echo $bssid