mirror of
https://github.com/novatiq/packages.git
synced 2026-04-29 23:18:42 +01:00
dcwifi: Update component versions
update package versions and hashes remove bzero patches remove uclibc++ patch refactor directory structure relocate mrmctl in menuconfig update macremapper patch Signed-off-by: Carey Sonsino <careys@edgewaterwireless.com> Signed-off-by: Carey Sonsino <csonsino@gmail.com>
This commit is contained in:
@@ -0,0 +1,256 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Dual Channel Wi-Fi Startup Script
|
||||
#
|
||||
# This script creates the proper network bridge configuration
|
||||
# necessary for Dual Channel Wi-Fi, and starts the dcwapd daemon
|
||||
#
|
||||
|
||||
verbose=1
|
||||
|
||||
uciconfig=dcwapd
|
||||
|
||||
result=
|
||||
|
||||
# NOTE: all functions write the result to the $result variable
|
||||
|
||||
get_channelsets()
|
||||
{
|
||||
# default to empty
|
||||
result=
|
||||
channelsets=$(uci show $uciconfig | grep "=channel-set$")
|
||||
for channelset in $channelsets; do
|
||||
channelset=$(echo "$channelset" | sed -rn "s/$uciconfig\.(.*)=.*/\1/p")
|
||||
result="$result $channelset"
|
||||
done
|
||||
if [ $verbose -eq 1 ]; then
|
||||
echo "Channel Sets: $result" 2>&1 | logger
|
||||
fi
|
||||
}
|
||||
|
||||
# $1 : the channel set name
|
||||
get_channelset_enabled()
|
||||
{
|
||||
# default to disabled
|
||||
result=0
|
||||
if [ -n "$1" ]; then
|
||||
result=$(uci get $uciconfig."$1".enabled)
|
||||
fi
|
||||
if [ $verbose -eq 1 ]; then
|
||||
echo "Channel Set \"$1\" Enabled: $result" 2>&1 | logger
|
||||
fi
|
||||
}
|
||||
|
||||
# $1 : the channel set name
|
||||
get_primary_bridge()
|
||||
{
|
||||
result=
|
||||
if [ -n "$1" ]; then
|
||||
result=$(uci get $uciconfig."$1".bridge)
|
||||
fi
|
||||
if [ $verbose -eq 1 ]; then
|
||||
echo "Channel Set \"$1\" Primary Bridge: $result" 2>&1 | logger
|
||||
fi
|
||||
}
|
||||
|
||||
# $1 : the channel set name
|
||||
get_datachannels()
|
||||
{
|
||||
# default to empty
|
||||
result=
|
||||
if [ -n "$1" ]; then
|
||||
result=$(uci get $uciconfig."$1".data_channels)
|
||||
fi
|
||||
if [ $verbose -eq 1 ]; then
|
||||
echo "Channel Set \"$1\" Data Channels: $result" 2>&1 | logger
|
||||
fi
|
||||
}
|
||||
|
||||
# $1 : the wlan interface name
|
||||
get_wifi_iface_num()
|
||||
{
|
||||
result=
|
||||
if [ -n "$1" ];then
|
||||
#result=$(echo "$1" | sed -n "s/wlan//p")
|
||||
result=$(echo "$1" | sed -rn "s/wlan([0-9]*).*/\1/p")
|
||||
fi
|
||||
}
|
||||
|
||||
# $1 : the bridge name
|
||||
get_bridge_network_name()
|
||||
{
|
||||
result=
|
||||
if [ -n "$1" ];then
|
||||
result=$(echo "$1" | sed -n "s/br-//p")
|
||||
fi
|
||||
}
|
||||
|
||||
# $1 : the wlan interface name
|
||||
set_iface_init_state()
|
||||
{
|
||||
result=
|
||||
if [ -n "$1" ]; then
|
||||
iface=$1
|
||||
# need to extract the "X" from wlanX
|
||||
get_wifi_iface_num "$iface"
|
||||
iface_num=$result
|
||||
if [ -n "$iface_num" ]; then
|
||||
# get the iface network
|
||||
init_net=$(uci get wireless.@wifi-iface[$iface_num].network)
|
||||
if [ -n "$init_net" ]; then
|
||||
# if the iface network is a bridge, but doesn't start with "br-"
|
||||
# I think we need to prepend it?
|
||||
net_type=$(uci get network."$init_net".type)
|
||||
if [ -n "$net_type" ] && [ "$net_type" = "bridge" ]; then
|
||||
prefix_ok=$(echo "$init_net" | grep "^br-")
|
||||
if [ -z "$prefix_ok" ]; then
|
||||
init_net="br-$init_net"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# make sure that the init_net section exists
|
||||
init_net_section=$(uci get dcwapd.init_net)
|
||||
if [ "$init_net_section" != "init_net" ]; then
|
||||
# the section did not exist
|
||||
uci set dcwapd.init_net=init_net
|
||||
fi
|
||||
|
||||
# save the initial network
|
||||
if [ $verbose -eq 1 ]; then
|
||||
echo "Saving '$iface' initial network '$init_net'" 2>&1 | logger
|
||||
fi
|
||||
uci set $uciconfig.init_net."$iface"="$init_net"
|
||||
uci commit
|
||||
|
||||
# save the initial network in the result variable
|
||||
result=$init_net
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# $1 : the wlan interface name
|
||||
get_iface_init_state()
|
||||
{
|
||||
result=
|
||||
if [ -n "$1" ];then
|
||||
init_net=$(uci get $uciconfig.init_net."$iface")
|
||||
|
||||
# if the response starts with "uci: ", it was an error not the real result
|
||||
err=$(echo "$init_net" | grep "^uci: ")
|
||||
if [ -z "$err" ]; then
|
||||
# no error, set the result
|
||||
result=$init_net
|
||||
|
||||
if [ $verbose -eq 1 ]; then
|
||||
echo "Got '$iface' initial network '$init_net'" 2>&1 | logger
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# $1 : the name of the data channel name to bring up
|
||||
datachannel_up()
|
||||
{
|
||||
if [ -n "$1" ]; then
|
||||
bridge=$(uci get $uciconfig."$1".bridge)
|
||||
interfaces=$(uci get $uciconfig."$1".interfaces)
|
||||
if [ $verbose -eq 1 ]; then
|
||||
echo "Creating Data Channel Bridge: $bridge" 2>&1 | logger
|
||||
fi
|
||||
|
||||
get_bridge_network_name "$bridge"
|
||||
netname=$result
|
||||
if [ -n "$netname" ]; then
|
||||
uci set network."$netname"=interface
|
||||
uci set network."$netname".type=bridge
|
||||
uci set network."$netname".proto=static
|
||||
uci set network."$netname".bridge_empty='1'
|
||||
fi
|
||||
|
||||
# create the bridge
|
||||
uci commit
|
||||
/etc/init.d/network reload
|
||||
|
||||
for iface in $interfaces; do
|
||||
# if iface is in a bridge, the bridge name should be stored in result
|
||||
set_iface_init_state "$iface"
|
||||
init_bridge=$result
|
||||
|
||||
# update uci with the new bridge info
|
||||
get_wifi_iface_num "$iface"
|
||||
iface_num=$result
|
||||
if [ -n "$iface_num" ]; then
|
||||
uci set wireless.@wifi-iface[$iface_num].network="$netname"
|
||||
fi
|
||||
|
||||
# manually put the interface into the data bridge
|
||||
# if iface is in a bridge, remove it before adding it to the data bridge
|
||||
if [ -n "$init_bridge" ]; then
|
||||
brctl delif "$init_bridge" "$iface" 2>&1 | logger
|
||||
fi
|
||||
brctl addif "$bridge" "$iface" 2>&1 | logger
|
||||
done
|
||||
|
||||
# commit uci changes and reload the network
|
||||
uci commit
|
||||
/etc/init.d/network reload
|
||||
#/etc/init.d/network restart
|
||||
# while [ 1 ]; do
|
||||
# ifconfig "$bridge" > /dev/null 2>&1
|
||||
# if [ $? == 0 ]; then
|
||||
# break;
|
||||
# fi
|
||||
# sleep 1
|
||||
# done
|
||||
fi
|
||||
}
|
||||
|
||||
# $1 : the name of the data channel to bring down
|
||||
datachannel_down()
|
||||
{
|
||||
if [ -n "$1" ]; then
|
||||
bridge=$(uci get $uciconfig."$1".bridge)
|
||||
interfaces=$(uci get $uciconfig."$1".interfaces)
|
||||
for iface in $interfaces; do
|
||||
if [ $verbose -eq 1 ]; then
|
||||
echo "Deconfiguring Data Channel Interface: $iface" 2>&1 | logger
|
||||
fi
|
||||
|
||||
# manually remove the interface from the data bridge
|
||||
brctl delif "$bridge" "$iface" 2>&1 | logger
|
||||
|
||||
get_iface_init_state "$iface"
|
||||
init_bridge=$result
|
||||
if [ -n "$init_bridge" ]; then
|
||||
# manually move the interface back to the original bridge
|
||||
brctl addif "$init_bridge" "$iface" 2>&1 | logger
|
||||
|
||||
# update uci with the new bridge and interface configuration
|
||||
get_wifi_iface_num "$iface"
|
||||
iface_num=$result
|
||||
get_bridge_network_name "$init_bridge"
|
||||
netname=$result
|
||||
if [ -n "$iface_num" ] && [ -n "$netname" ]; then
|
||||
uci set wireless.@wifi-iface[$iface_num].network="$netname"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [ $verbose -eq 1 ]; then
|
||||
echo "Deconfiguring Data Channel Bridge: $bridge" 2>&1 | logger
|
||||
fi
|
||||
|
||||
# delete the bridge from uci
|
||||
get_bridge_network_name "$bridge"
|
||||
netname=$result
|
||||
if [ -n "$netname" ]; then
|
||||
uci delete network."$netname"
|
||||
fi
|
||||
|
||||
# commit uci changes and reload the network
|
||||
uci commit
|
||||
/etc/init.d/network reload
|
||||
#`/etc/init.d/network restart`
|
||||
fi
|
||||
}
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
# Setting the stop value makes the restart script unreliable when invoked by LuCI
|
||||
#STOP=0
|
||||
|
||||
scriptdir=/etc/dcwapd
|
||||
|
||||
#validate_section_dcwapd() {
|
||||
# uci_validate_section dcwapd general "${1}" \
|
||||
# 'enabled:bool:1'
|
||||
#}
|
||||
|
||||
start() {
|
||||
# validate_section_dcwapd dcwapd
|
||||
|
||||
# only run the start script if the enabled uci option is set properly
|
||||
enabled=$(uci get dcwapd.general.enabled)
|
||||
if [ "${enabled}" = "1" ]; then
|
||||
${scriptdir}/start_dcwapd.sh
|
||||
else
|
||||
echo "dcwapd is disabled in UCI"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
stop() {
|
||||
${scriptdir}/stop_dcwapd.sh
|
||||
# Add a sleep after stopping because an immediate restat will fail otherwise
|
||||
sleep 1
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
######################################################
|
||||
# Copyright 2018 EWSI
|
||||
#
|
||||
# Licensed to the public under the Apache License 2.0.
|
||||
######################################################
|
||||
# Dual Channel Wi-Fi AP Daemon configuration
|
||||
|
||||
###################
|
||||
# General Options #
|
||||
###################
|
||||
# The "enabled" option controls the run state of the Dual Channel Wi-Fi AP Daemon
|
||||
# 0 - disabled, 1 - enabled
|
||||
# The "tmpdir" option MUST be specified
|
||||
# option tmpdir '<path_of_temp_dir>'
|
||||
|
||||
config general 'general'
|
||||
option enabled 0
|
||||
option tmpdir '/tmp/dcwapd'
|
||||
|
||||
################
|
||||
# Channel Sets #
|
||||
################
|
||||
# Sections of type "channel-set" define a Dual Channel Wi-Fi primary channel,
|
||||
# along with it's associated data channels
|
||||
#
|
||||
# The "data_channels" option is a space-delimited list of "datachannel"-typed instance names
|
||||
|
||||
config channel-set 'channelset0'
|
||||
option enabled 0
|
||||
# option enabled 1
|
||||
option ssid 'OpenWrt'
|
||||
option bridge 'br-lan'
|
||||
option data_channels 'datachannel0'
|
||||
|
||||
#config channel-set 'channelset1'
|
||||
# option enabled 0
|
||||
# option ssid 'OpenWrt2'
|
||||
# option bridge 'br-lan'
|
||||
# option data_channels 'datachannel1'
|
||||
|
||||
#################
|
||||
# Data Channels #
|
||||
#################
|
||||
# Sections of type "datachannel" define a Dual Channel Wi-Fi data channel,
|
||||
# along with it's associated bridge and wireless interfaces
|
||||
#
|
||||
# The "interfaces" option is a space-delimited list of wireless interface names
|
||||
|
||||
config datachannel 'datachannel0'
|
||||
option ssid 'DCW0'
|
||||
option bridge 'br-dc0'
|
||||
option interfaces 'wlan2 wlan5'
|
||||
|
||||
#config datachannel 'datachannel1'
|
||||
# option ssid 'DCW1'
|
||||
# option bridge 'br-dc1'
|
||||
# option interfaces 'wlan4'
|
||||
|
||||
####################
|
||||
# Init Net Options #
|
||||
####################
|
||||
# The "init_net" section MUST be specified
|
||||
# This section will be used to save and restore the state of the data interfaces
|
||||
config init_net 'init_net'
|
||||
|
||||
###############
|
||||
# Filter Sets #
|
||||
###############
|
||||
# Sections of type "filter-set" define a Dual Channel Wi-Fi group of filters,
|
||||
# along with it's associated MAC address and filter rules
|
||||
#
|
||||
# The "TFP_Default" filter set MUST be defined, although it is not required
|
||||
# to have any associated filter rules
|
||||
# The "TFP_Default" filter mac option can have the value of '*', meaning match
|
||||
# all MAC addresses
|
||||
#
|
||||
# The "filters" option is a space-delimited list of "filter"-typed instance names
|
||||
|
||||
config filter-set 'TFP_Default'
|
||||
option mac '*'
|
||||
option filters 'filter0 filter1'
|
||||
|
||||
#config filter-set 'filterset0'
|
||||
# option mac '00:00:BE:EF:F0:0D'
|
||||
# option filters 'filter2'
|
||||
|
||||
|
||||
################
|
||||
# Filter Rules #
|
||||
################
|
||||
# Sections of type "filter" define a Dual Channel Wi-Fi filter,
|
||||
# along with it's associated filter parameters
|
||||
#
|
||||
# Any or all of the filter options may be set to '*' to match
|
||||
# all values
|
||||
|
||||
config filter 'filter0'
|
||||
option packet_size '*'
|
||||
option source_ip '*'
|
||||
option source_port '80'
|
||||
option protocol 'tcp'
|
||||
option dest_port '*'
|
||||
|
||||
config filter 'filter1'
|
||||
option packet_size '*'
|
||||
option source_ip '*'
|
||||
option source_port '443'
|
||||
option protocol 'tcp'
|
||||
option dest_port '*'
|
||||
|
||||
#config filter 'filter2'
|
||||
# option packet_size '*'
|
||||
# option source_ip '*'
|
||||
# option source_port '22'
|
||||
# option protocol 'tcp'
|
||||
# option dest_port '*'
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Dual Channel Wi-Fi Startup Script
|
||||
#
|
||||
# This script creates the proper network bridge configuration
|
||||
# necessary for Dual Channel Wi-Fi, and starts the dcwapd daemon
|
||||
#
|
||||
|
||||
# Note - shellcheck cannot deal with the dynamic sourcing
|
||||
# shellcheck disable=SC1090
|
||||
# which also messes with variables defined in the sourced file
|
||||
# shellcheck disable=SC2154
|
||||
scriptdir=$(dirname -- "$(readlink -f -- "$0")")
|
||||
. "$scriptdir"/dcwapd.inc
|
||||
|
||||
get_channelsets
|
||||
# get the list of channel sets
|
||||
channelsets=$result
|
||||
|
||||
for channelset in $channelsets; do
|
||||
if [ -n "$channelset" ]; then
|
||||
get_channelset_enabled "$channelset"
|
||||
enabled=$result
|
||||
if [ "$enabled" = "1" ]; then
|
||||
# the channel set is enabled
|
||||
|
||||
# get the list of data channels used by the channel set
|
||||
get_datachannels "$channelset"
|
||||
datachannels=$result
|
||||
for datachannel in $datachannels; do
|
||||
datachannel_up "$datachannel"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# start dcwapd, sending stdout and stderr to the system log
|
||||
dcwapd 2>&1 | logger &
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Dual Channel Wi-Fi Startup Script
|
||||
#
|
||||
# This script creates the proper network bridge configuration
|
||||
# necessary for Dual Channel Wi-Fi, and starts the dcwapd daemon
|
||||
#
|
||||
|
||||
# Note - shellcheck cannot deal with the dynamic sourcing
|
||||
# shellcheck disable=SC1090
|
||||
# which also messes with variables defined in the sourced file
|
||||
# shellcheck disable=SC2154
|
||||
scriptdir=$(dirname -- "$(readlink -f -- "$0")")
|
||||
. "$scriptdir"/dcwapd.inc
|
||||
|
||||
pid=$(pidof dcwapd)
|
||||
if [ -n "$pid" ]; then
|
||||
if [ "$verbose" -eq "1" ]; then
|
||||
echo "Stopping dcwapd..." 2>&1 | logger
|
||||
fi
|
||||
kill "$pid"
|
||||
fi
|
||||
|
||||
get_channelsets
|
||||
# get the list of channel sets
|
||||
channelsets=$result
|
||||
|
||||
for channelset in $channelsets; do
|
||||
if [ -n "$channelset" ]; then
|
||||
# we don't care if it is enabled, tear it down
|
||||
# get_channelset_enabled $channelset
|
||||
# enabled=$result
|
||||
# if [ $enabled = "1" ]; then
|
||||
# # the channel set is enabled
|
||||
|
||||
# get the list of data channels used by the channel set
|
||||
get_datachannels "$channelset"
|
||||
datachannels=$result
|
||||
for datachannel in $datachannels; do
|
||||
datachannel_down "$datachannel"
|
||||
done
|
||||
# fi
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user