#!/bin/bash ############################################################################### # # # IPFire.org - A linux based firewall # # Copyright (C) 2012 IPFire Network Development Team # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program. If not, see . # # # ############################################################################### function wireless_create() { local device=${1} local phy=$(phy_get ${2}) local type=${3} local mac=${4} assert isset device assert isset phy assert isset type isset mac || mac=$(mac_generate) assert phy_exists ${phy} assert isoneof type managed __ap iw phy ${phy} interface add ${device} type ${type} if device_exists ${device}; then device_set_address ${device} ${mac} fi device_set_up ${device} } function wireless_remove() { local device=${1} assert device_exists ${device} device_set_down ${device} iw dev ${device} del } function wireless_set_channel() { local device=${1} local channel=${2} assert isset device assert device_exists ${device} assert isset channel iw dev ${device} set channel ${channel} $@ }