2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2017 IPFire Network Development Team #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
22 wireless_mesh_to_wpa_supplicant
() {
26 local file="${WPA_SUPPLICANT_CONF_DIR}/${device}.conf"
36 channel
=$
(cli_get_val
"${arg}")
39 mesh_id
=$
(cli_get_val
"${arg}")
42 psk
=$
(cli_get_val
"${arg}")
45 error
"Unrecognized argument: ${arg}"
51 if ! isset mesh_id
; then
52 error
"Mesh ID is not set"
56 if ! wireless_channel_is_valid
"${channel}"; then
57 error
"Invalid wireless channel given: ${channel}"
61 # Ensure we can write the file
62 make_parent_directory
"${file}"
65 # Write a config header
66 wpa_supplicant_config_header
68 print_indent
0 "# ${MESH_ID}"
69 print_indent
0 "network={"
70 print_indent
1 "ssid=\"${MESH_ID}\""
73 print_indent
1 "# Launch in 802.11s mesh mode"
74 print_indent
1 "mode=5"
78 print_indent
1 "# Authentication"
80 print_indent
1 "key_mgmt=SAE"
81 print_indent
1 "psk=\"${psk}\""
83 print_indent
1 "key_mgmt=NONE"
88 if isset channel
; then
89 print
" frequency=$(wireless_channel_to_frequency "${channel}")"